Categories
Tools

How to run or Configure Apache to use PHP as CGI

Last updated on November 22nd, 2010 at 11:29 am

To get Apache to use the PHP CGI for files with the .php extension, you need to tell Apache where to find the php-cgi executable, which is installed to /usr/local/bin/php-cgi by default. You also need to give Apache permission to execute files in that location. Add the following to an appropriate place in your httpd.conf file (default location /usr/local/apache2/conf/httpd.conf):

# CUSTOM: Add PHP 5 parsing (via CGI) handler and action 
ScriptAlias /local-bin /usr/local/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi 
<directory "/usr/local/bin">
 Order allow,deny 
Allow from all
</directory>
Click to rate this tutorial!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *