Problems running PHP as CGI under Apache, please help!

Problems running PHP as CGI under Apache, please help!

Post by jfo » Tue, 03 Nov 1998 04:00:00



I'm a newbie to Apache, PHP and CGI. I've tried to RTM but I just
cannot find out how to get this to work. I need for PHP to run as a
CGI process. Don't ask why, it's for a client.

My setup:
Intel P-133, 48MB RAM.
RedHat Linux 5.1
Apache 1.2.6
PHP 3.0.5

Yes I know there's a more recent version of Apache, once again, client
issue. Maybe I can get them to upgrade later.

What I've done:
Installed Apache: It works fine when serving HTML.
Installed PHP. The following script runs from the command line:
<?
echo ("Hello Universe!\n\n");
?>
It prints, Hello Universe, and no error messages.

I've read the PHP mailing list archives and tried to glean ideas from
messages posted there. I'm going to subscribe to the list again to
post this question if I have to, but the list is *so* busy I can't
keep up with it.
I've been over the PHP and Apache docs several times. Maybe I'm just
stupid and missed the obvious...but I still don't know what to do.
I've twiddled httpd.conf and srm.conf a bit based on stuff I read in
the mailing list archives. Nothing seemed to happen. I'd post the
changes, but I'm on a Win98 box right now...That's why I don't have
error messages in front of me right now either. Doh! The most frequent
error was something like, "file not found".

Oh, yeah, I *did* stop and restart Apache between editing sessions.

I know this can't be too hard to get working, I just need a whack on
the side of the head to get me started!

 
 
 

Problems running PHP as CGI under Apache, please help!

Post by Rasmus Lerdo » Tue, 03 Nov 1998 04:00:00


Quote:> I've read the PHP mailing list archives and tried to glean ideas from
> messages posted there. I'm going to subscribe to the list again to
> post this question if I have to, but the list is *so* busy I can't
> keep up with it.

You do not need to be subscribed to the PHP3 mailing list
in order to send a message to it.  And you can even read
it with your news reader by pointing it at

-Rasmus

 
 
 

Problems running PHP as CGI under Apache, please help!

Post by Jeff F » Tue, 03 Nov 1998 04:00:00


>You do not need to be subscribed to the PHP3 mailing list
>in order to send a message to it.  And you can even read
>it with your news reader by pointing it at

>-Rasmus

Cool!, Thanks!
and Thanks for writing PHP too!
 
 
 

Problems running PHP as CGI under Apache, please help!

Post by Jesus M. Castagnet » Fri, 06 Nov 1998 04:00:00



(Mon, 02 Nov 1998 03:51:48 GMT):

Quote:>I'm a newbie to Apache, PHP and CGI. I've tried to RTM but I just
>cannot find out how to get this to work. I need for PHP to run as a
>CGI process. Don't ask why, it's for a client.
[...snip...]
>That's why I don't have
>error messages in front of me right now either. Doh! The most frequent
>error was something like, "file not found".
>Oh, yeah, I *did* stop and restart Apache between editing sessions.
>I know this can't be too hard to get working, I just need a whack on
>the side of the head to get me started!

One of the follwoing may help:

- check that the PHP binary is executable & readable
  (e.g. chmod ug+rx php3)

- check that the php3 is in the cgi-bin dir

- check that if it is in the cgi-bin, you are using the URL:
http://www.foo.com/cgi-bin/php3/coolscript.php3
(you will need a different path if "coolscript.php3" is not
in cgi-bin)

- if php3 is not in cgi-bin, are you allowing script execution
in the dir where the script resides?

- consider associating the .php3/.phtml extensions w/ the action of
passing the script to the PHP3 binary: (modified from the sample
Apache config)

AddType application/x-httpd-php3-precomp .php
Action application/x-httpd-php3-precomp "/cgi-bin/php3 -e"
AddType application/x-httpd-php3 .phtml .php3
Action application/x-httpd-php3 /cgi-bin/php3

The error you are seeing looks to me that is due to a wrong Alias
directive, or the wrong URL to the script or the php3 cgi.

Good luck.

====

"Jikishin kore dojo nari" (Zen saying)
"Life is, ask no more" (Me :)
Pilot stuff & etc.:
  http://www.geocities.com/ResearchTriangle/Lab/1059/
Metalloprotein DB and browser:
  http://metallo.scripps.edu/index.html

 
 
 

1. Strange problem with running php from within a cgi program in Apache 1.3

Hello,
Ok First let me tell you what I am trying to do; I have 2 programs, one in
C and one in php that I want to have be able to run the php script from
within the C program with a system("/usr/bin/php script.php").  And it
works fine on my home server, but on the production server it doesn't
work.  Note that servers are not exactly the same(different modules,etc.)
What I mean by doesn't work is the wierd part.  Instead of giving me an
error, what it does is actually insert the cgi program where the system()
call is.  I have actually reproduced this with a simple bash script
bash.cgi:

#!/bin/bash
export REDIRECT_STATUS=200; # Keep php from generating security warning.
echo "Content-type: text/html\n\n"
/usr/bin/php -v
echo ""

Instead of just printing "4.2.2", the script source gets outputted.  What
it seems like is instead of just running the script, the php is actually
executing the cgi script like "php bash.cgi".   I don't understand why it
is doing this, and I was wondering if anyone could give me some insight.

Note: Both programs are too big to rewrite in one language, and I cannot
upgrade to apache 2.0.

Thanks,
Brian

2. Abrupt PPP termination with ISP

3. problem running cgi-forms on apache!!!!!! please help

4. Unix PC for $350

5. Automatic account registration

6. PHP and Apache problems.. please help

7. ncpfs problems

8. php running as cgi problem

9. Apache 1.3.14 / Netware Perl/CGI PROBLEM, Please help!

10. Apache w/ PHP and SSL: w/ PHP OK - w/out PHP NOK

11. APACHE CGI CONFIG PROBLEM.. PLEASE HELP

12. Apache/CGI directory access problem -- please help.