LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Adding PHP capability to Apache (https://www.linuxquestions.org/questions/linux-server-73/adding-php-capability-to-apache-516276/)

kaplan71 01-04-2007 10:43 AM

Adding PHP capability to Apache
 
Hi there --

I have a Red Hat Enterprise Linux 3 system running Apache 1.3.33, and have received a request to activate php on the server. Currently, any php page that is brought up shows only the raw code.

The system does have php 4.3.4 and php 5.0.4 installed, but when I do an http -l command, I notice that mod.so is not one of the modules listed, and the httpd.conf file does not contain any reference to php.

How can I activate php on the server without the risk of overwriting any of the current configuration settings? Thanks.

rylan76 01-05-2007 03:21 AM

Quote:

Originally Posted by kaplan71
Hi there --

I have a Red Hat Enterprise Linux 3 system running Apache 1.3.33, and have received a request to activate php on the server. Currently, any php page that is brought up shows only the raw code.

The system does have php 4.3.4 and php 5.0.4 installed, but when I do an http -l command, I notice that mod.so is not one of the modules listed, and the httpd.conf file does not contain any reference to php.

How can I activate php on the server without the risk of overwriting any of the current configuration settings? Thanks.

Hi

Not sure about your setup, but when I install Apache to have PHP capability I do the following.

1. Compile Apache with the following configure line:

./configure --enable-so --enable-mods-shared=/usr/local/apache2/modules/libphp5.so

2. Compile and configure PHP:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-apache2 --with-config-file-path=/usr/local/lib

3. Add these to httpd.conf in apache directory apache2/conf

LoadModule php5_module /usr/local/apache2/modules/libphp5.so

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

So maybe, if you have the PHP module present already (or you got it from an RPM or something) all you might need to do is add

LoadModule php5_module /usr/local/apache2/modules/libphp5.so

to your httpd.conf and do

apache2/bin/apachectl restart

...


All times are GMT -5. The time now is 08:24 PM.