Jump to content

Install PHP as CGI in Apache


Recommended Posts

I'm trying to build from sources a basic installation of Apache (2.2.11) with PHP (5.2.9) running as CGI on CentOS 5.2.  The Apache configuration was (according to config.nice):

#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/usr/local/apache" \
"--enable-rewrite" \
"--enable-so" \
"--enable-expires" \
"--enable-deflate" \
"--disable-imap" \
"--disable-userdir" \
"--disable-include" \
"$@"

 

With this installed and running, the test HTML web page is served correctly.  Then I compiled PHP with:

 

./configure \
--enable-force-cgi-redirect \
--prefix=/usr/local/apache/php

 

Then copied the PHP binary to the Apache cgi-bin directory, and modified httpd.conf with:

 

Action application/x-httpd-php /usr/local/apache/php/cgi-bin/php
AddHandler application/x-httpd-php .php

 

After restarting index.html is still served ok, but attempting a test PHP file called info.php (containing phpinfo()) gives:

 

The requested URL /usr/local/apache/bin/php/info.php was not found on this server.

 

I've read everything I can find, and experimented with the config, but always get either this error or a server 500 if I really mess things up!  Any offers on the direction to take to get out of this?

Link to comment
https://forums.phpfreaks.com/topic/147756-install-php-as-cgi-in-apache/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.