Help - Search - Members - Calendar
Full Version: Php Won't Run From Cgi-bin
Linuxhelp > Support > Technical Support
cagey cretin
Hey all, I hope someone can point me to the errors of my ways...

I'm running RH9, apache 2, php4, perl 5. I've set up ScriptAlias in httpd.conf for main & virtualhost sections.

I can call & run .pl scripts from the cgi-bin just fine. I can call php from anywhere, except the cgi-bin. blink.gif Why can't the php scripts run from there?

Thanks in advance,

Joe Wilk
did you move your php.exe file to your cgi-bin directory?
cagey cretin
Thanks Chris, and greetings from the Washington DC area!

In case I misunderstood, there is no php.exe on my machine. biggrin.gif

I moved an executable php file into the cgi-bin, made sure the ownership/permissions were the same as the working .pl files there. The php file does not run. I get a premature end of headers error message. The same file works just fine when placed in a directory under the document root (no error message & file executes).

Note: the cgi-bin is not under document root. Rather, it is under the users home directory next to the document root. I have set ScriptAlias to point to this path. Again, pl scripts are executed in this directory. ohmy.gif

sorry about the php.exe mistake...should have been just php

should be located in /usr/local/bin directory

how is php installed? from rpm or source?

what is the error that shows up when trying to run php from cgi-bin directory
could you paste the error here so we can look at it

and post your httpd.conf file also
On most standard installs, PHP is built as an Apache module, and PHP files won't run from the cgi-bin directory.

I don't run php files in my cgi-bin directory ... the next question is, do you have to have the PHP files in cgi-bin ... if not, put them elsewhere.

Here is a way to put a directory under cgi-bin that will allow php files to run there:

Or a way to make php work in the cgi-bin directory:

But you might have issues and break other parts of your cgi-bin ... so make sure to backup httpd.conf before you make changes...
cagey cretin
Thanks guys. I'm glad to know that it wasn't something I did.

Hughesjr, there is no need to run php from the cgi-bin; I just thought there was a reason to keep scripts in a folder not within the document root (I'm using ScriptAlias)...

Regards from almost nearly Washington DC,

Joe Wilk
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.