How to Configure Apache to run PHP Scripts on linux

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am new to this PHP and linux OS as well. I am trying to install to
Apache 2.2.8 and PHP 5.2.5 and do some PHP coding. I've installed
Apache and tested it. Its working fine. Then, I installed PHP 5.2.5.
The command I used to configure is
./configure \

After Installing PHP, I am not able to stop/start Apache. The error
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/ into server: /usr/
local/apache2/modules/ undefined symbol:

Then I surfed some groups in net and and tried the following changes
to 'httpd.conf' file:
[Deleted] LoadModule php5_module modules/
<IfModule dir_module>
DirectoryIndex index.php default.php index.html index.htm

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

AddType application/x-httpd-php .php .php3

Then I installed PHP again. As a result, "LoadModule php5_module
modules/" line got added in the httpd.conf file
automatically at line no 53. Still I face the same error which I
mentioned earlier.

Again I googled and did the following changes in addition to the
previous changes:
Copied the 'php.ini-dist' file to the location "/usr/local/lib/" and
renamed it to 'php.ini'
Still my Apache is not starting.

Then I removed the line "LoadModule php5_module modules/"
from 'httpd.conf' file and tried to start Apache. This time I am able
to start and stop apache. But I cannot run PHP scripts.

It seems like the problem is with the '' file which
automatically gets created with PHP installation. Can anyone provide
me solution for this.


Re: How to Configure Apache to run PHP Scripts on linux

On Thu, 14 Feb 2008 07:34:19 -0800, kodaliece wrote:

Quoted text here. Click to load it

you won't be able to run any php if the module isn't enabled

from the terminal type

sudo a2enmod

it should give you a list of all modules that can be enabled, just pick
the right one.

ls -al the /etc/apache2/mods-enabled/ directory, there should be a
php5.conf and a php5.load in there. is in /usr/lib/apache2/modules/ and is called via php5.load

ps: did you know you could just install php5 without having to compile it?

sudo aptitude install package

Re: How to Configure Apache to run PHP Scripts on linux wrote:

Quoted text here. Click to load it

OK, now tell us what distribution you're using here, please.

Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

In a museum in Havana, there are two skulls of Christopher Columbus,
"one when he was a boy and one when he was a man."
                -- Mark Twain

Site Timeline