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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.