Setting PHP as A CGI with Apache and SUEXECTo setup PHP to run as a CGI for extra security on apache using SUEXEC you will need to follow the steps below:
- Setup apache with SUEXEC and make sure it works (See the apache site for details).
- Setup your apache site/vhosts for CGI from a
Install PHP from source and compile with the
Setup your vhost/site as follows:
Options +ExecCGI Action php-script /cgi-bin/php AddHandler php-script .php
This will make all files ending in
.php will be passed through our own PHP script in the /cgi-bin
Create the following
/cgi-bin/phpfile with just one line:
Change the permissions on this file to 0755 like any other CGI script
Create an example PHP script as
Test by browsing to:
/test.phpin your browser.
Last updated: 25/11/2005