Discussion:
PHP working as CGI with some features
(too old to reply)
i***@mail.ru
2003-09-10 13:57:41 UTC
Permalink
Hi everyone,
I am trying to got PHP working as CGI with Apache web-server with
following features:
1) There are NO "#!/usr/local/bin/php"-headers (or like this) in the
scripts.
2) Executable Php-binary is located out of www-tree of apache server.
I've set in httpd.conf:
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /usr/local/bin/php
Options [...] ExecCGI # for all /www directory
and chmod 755 test.php

And I got in my browser:
"Not Found
The requested URL /usr/local/bin/php/usr/local/bin/php/test.php was
not found on this server."

If I comment:

# AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php

or:

AddType application/x-httpd-php .php
# AddHandler application/x-httpd-php .php

then I got:
"The requested URL /usr/local/bin/php/test.php was not found on this
server."
----
Version of PHP is 4.3.3. It compiled with options:
'./configure' '--enable-force-cgi-redirect' '--enable-discard-path'
'--enable-memory-limit' '--with-config-file-path=/usr/local/etc'
'--with-mysql' '--enable-calendar' '--enable-bcmath'
'--with-ming=/usr/lib'
and working cli mode fine.
Duane L
2003-09-11 20:58:48 UTC
Permalink
Try putting your php script in
/var/www/cgi-bin where apache expects to find cgi.
I recently was presented with this same problem when I put up
a section of our website:

http://www.promopeddler.com/Promotional_Products/Free-Web-Content.htm

Essentially you call it just like a regular cgi file,
http://www.promopeddler.net/cgi-bin/weather.php?zipCode=90120

Also, I eventually figured out I had to use "<?php" as the opening tag,
just "<?" didn't work even though I had short tags enabled.
.
Post by i***@mail.ru
Hi everyone,
I am trying to got PHP working as CGI with Apache web-server with
1) There are NO "#!/usr/local/bin/php"-headers (or like this) in the
scripts.
2) Executable Php-binary is located out of www-tree of apache server.
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /usr/local/bin/php
Options [...] ExecCGI # for all /www directory
and chmod 755 test.php
"Not Found
The requested URL /usr/local/bin/php/usr/local/bin/php/test.php was
not found on this server."
# AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php
# AddHandler application/x-httpd-php .php
"The requested URL /usr/local/bin/php/test.php was not found on this
server."
----
'./configure' '--enable-force-cgi-redirect' '--enable-discard-path'
'--enable-memory-limit' '--with-config-file-path=/usr/local/etc'
'--with-mysql' '--enable-calendar' '--enable-bcmath'
'--with-ming=/usr/lib'
and working cli mode fine.
Loading...