PHP as CGI in Apache
| From: | Aaron Smith | Date: | Fri, 11 Apr 2003 19:02:16 +0000 |
| Subject: | PHP as CGI in Apache | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-10583@lists.php.net to get a copy of this message | ||
Ok. So we've been using PHP via an Apache module on our
servers for quite some time. Well, one of the php guys want's to
try running PHP on a test server as a CGI interpreter. (Don't ask...)
I have a Redhat 7.2 server with latest PHP RPM's. /usr/bin/php is
installed and appears to be the CGI compiled version. After digging
around on some web pages, I commented out the PHP module lines in
httpd.conf, copied /usr/bin/php into /var/www/php4 and then added these
lines to httpd.conf:
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
ScriptAlias /php4/ "/var/www/php4/"
Action application/x-httpd-php /php4/php
After restarting apache, I pointed a browser at a simple info php script
in the normal apache root directory. I was given a 404 error and the
apache log file said:
script not found or unable to stat: /var/www/php4php
Just for grins, I created a symlink named /var/www/php4php and pointed
it to /var/www/php4/php. When I did that and reloaded my test page, I
got a number of PHP style errors complaining about parse errors in
/var/www/php4/php. Am I missing something simple here?
And yes, I know that PHP via CGI is generally frowned upon. This isn't
for a public server, it's for an internal test server and only so that
this developer can test a few things and then we'll go back to the
normal mode of operation.
--
-----------------------------------------------------------------
Aaron Smith vox: 269.226.9550 ext.26
Network Director fax: 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend Your Expertise
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc