running php locally

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

running php locally

Post by allelopath »

I'm getting back into writing some php, after quite some time. I'm a little rusty.

I have apache started. Document Root is /srv/www/htdocs. The site I am working on is in /srv/www/htdoc/MySite/. In that directory are index.htm and mypage.php. index.htm displays, with a link to mypage.php.When I click on this link, firefox says:

You have chosen to open mypage.php
which is a: PHP file
from: /srv/www/htdocs/MySite
What should firefox do with this file?
Open with [Browse[
Save to disk

What have I forgotten to set up, initialize, turn on ...?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Yuo need to add the directive in httpd.conf that tells apache what to do with php files. I added this at the end of my apache config file

Code: Select all

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

Post by allelopath »

Running linux, not windows, my bad for not specifying.

I already have this in /etc/apache2/httpd.conf:
AddType application/x-httpd-php .php

Also there is this statement:
# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

loadmodule.conf has this line:
LoadModule php4_module /usr/lib/apache2-prefork/libphp4.so

I have verified that libphp4.so is there.

hmph.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Did you restart the apache?
What linux distriution do you use? How did you install apache and php?
allelopath
Forum Commoner
Posts: 34
Joined: Tue Mar 16, 2004 5:21 am

Post by allelopath »

I did restart apache, though there was really no reason to because the conf file stuff was already there.

SuSE 9.2 Pro

I think I installed apache and php via Yast (some time ago)

This worked at one point, so I think everything that is needed is installed.
Something just not initialized.
Post Reply