November 16th, 2000, 07:04 AM
I' m trying to setup Apache (1.3.12) with suexec and PHP (4.0.3pl1).
Everything works fine, except one thing:
I use PHP as a script-processor, not as a module. I added an "AddHandler php4-script .php" and an "Action php4-script /cgi-bin/php" which refers to a file "php" in a directory "/usr/local/apache/cgi-bin/" containing only one line:
In the directory "usr/local/apache/bin/" is the php-executable.
The parsing of the php-files is perfect. But suexec doesn't react at all. I know suexec is working fine, because it does react on a .cgi-file.
As I replace "php4-script" in the AddHandler and Action to "cgi-script", suexec does react. SUexec says: [2000-11-15 10:43:31]: info: (target/actual) uid: (bart/bart) gid: (ftp/ftp).
But php does not get parsed anymore. I get an Internal Server Error.
The error_log file says:
failed to open log file
fopen: Permission denied
[Wed Nov 15 10:43:31 2000] [error] [client xxx.xxx.xx.xx] Premature end of
script headers: /path/to/file/testfile.php
What do I do wrong? Do I need to copy the entire php-executable into each user-directory? And how do I have to tell suexec that php is a script-processor?
November 16th, 2000, 07:02 PM
>>failed to open log file
>>fopen: Permission denied
What is the "ls -Al" output of that log file?
>>Do I need to copy the entire php-executable into each user-directory?
No if that script has 755 permission (-rwxr-xr-x). First, the script needs to give other (world) or group permission to execute it. Then it will executed under the userid. It doesn't matter where the script is.
>>And how do I have to tell suexec that php is a script-processor?
Suexec only execute CGI script under the same userid, you don't need to tell, it will do so. BTW, I thought you already solved this problem with AddHandler and Action to "cgi-script".
You actually can do this:
AddHandler cgi-script .cgi .php
You don't need a separate AddHandler.
November 17th, 2000, 04:26 AM
Thank you for your reply, freebsd.
>>>failed to open log file
>>>fopen: Permission denied
>What is the "ls -Al" output of that log file?
What log file do you mean? I don' t know what log file is refered to in the httpd_log...
>BTW, I thought you already solved this problem with AddHandler and Action to "cgi-script".
>You actually can do this:
>AddHandler cgi-script .cgi .php
>You don't need a separate AddHandler.
I did not use a separate AddHandler, I did use only one. I deleted the .cgi, but I also tried it with the .cgi added. Neither did work...
November 17th, 2000, 11:25 AM
>>What log file do you mean?
You told me "failed to open log file" and that's the one.
November 18th, 2000, 04:39 AM
Within the error_log-file is a line that says:
"failed to open log file"
It doesn't say what log file is being opened.
Besides: I tried the same thing now with "cgiwrap". It fails at the same point: when I do not let the file be treated by the wrapper, it is parsed by php without any problem. But when I do add a wrapper-action (suexec or cgi-wrap, it makes no difference) it gets another uid and then it isn't parsed by php anymore. On the server itself I tried to handle a php-script with another user, and it causes no problem at all...
November 18th, 2000, 09:29 AM
If the error log says "failed to open log file", obviously it's not the Apache error log that I was talking about. Check your script and see what file it tried to open and give me the "ls -Al" output of that file.
If it's not your script and you don't know at which point it tries to open a file, post that script here.
November 20th, 2000, 12:26 PM
It was the same with all te scripts. But in the meantime someone solved the problem by writing his own php-wrapper.