Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've recently been doing some work on a friends web server, however I'm having trouble executing PHP scripts. The server is CentOS 5.8. This is what the Apache logs look like after trying to execute a script (test.php, permission 0644):

[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] SoftException in Application.cpp:256: File "/serv/website/www/test.php" is writeable by group
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] Premature end of script headers: test.php
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/cp_errordocument.shtml
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] unable to include "cp_errordocument.shtml" in parsed file /serv/website/www/500.shtml
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/favicon.ico
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] File does not exist: /serv/website/www/cp_errordocument.shtml
[Mon Aug 13 09:47:41 2012] [error] [client -.-.-.-] unable to include "cp_errordocument.shtml" in parsed file /serv/website/www/404.shtml

And this is the only message I get when I visit the script:[an error occurred while processing this directive]

I've been Googling this issue for hours, and I still can't find a solution. Any help is appreciated! I'm pretty unfamiliar with server administration, so let me know if you need any more info.

EDIT: Here is my test.php

<?php
echo phpinfo();
?>

EDIT 2: When I add #!/usr/bin/php to the top of my PHP script, I am able run it in the shell, however I still get the same results in the browser.

share|improve this question
    
Could you post test.php source? Also, does <? phpinfo(); ?> work? –  Chida Aug 13 '12 at 17:14
    
@Chida That is all the test.php consisted of, so no, it is not working. –  Andrew De Forest Aug 13 '12 at 17:19
    
What is Application.cpp? And do all the paths referenced in the errors (/serv/website/...) really exist? –  larsks Aug 13 '12 at 17:22
    
I'm not sure what Application.cpp is, I assume it's just a built-in module –  Andrew De Forest Aug 13 '12 at 17:25
    
If you don't know what it is that should probably be the place to start looking. Application.cpp is logging the first error in your error log, and the error seems fairly easy to interpret. As Iain says down below, try fixing that and see what happens. –  larsks Aug 13 '12 at 17:34
add comment

2 Answers

up vote 0 down vote accepted

Without more information these are the suggestions I can give you.

The 'Premature end of script headers' means the script error'd before sending the headers. So one solution for testing the problem would be to turn off the buffering of output. If that doesn't work. The most obvious one would be if the script has non unix newlines it can sometimes mess with execution.

The easiest way would be to run the script from command line to see what errors it generates. You may want to change the permissions to 0755 while testing.

Try this and update us.

EDIT:

SoftException in Application.cpp:256: File "/serv/website/www/test.php" is writeable by group means apache permissions are configured wrong. Check the permissions for the path /serv/website/www make sure they aren't 777. Try 755 for directories.

//Down vote for what reason o.O?

share|improve this answer
    
Thank you Jay, I will give this a shot –  Andrew De Forest Aug 13 '12 at 17:25
    
I can't downvote yet...but this looks like a question for the OP more than an answer. –  ldx.a.ldy.c Aug 13 '12 at 17:37
    
I don't have the ability to comment on the user's question post because i don't have 50 rep. So I have to ask questions in my proposed answer. –  Jay Aug 13 '12 at 17:40
    
Jay, the permissions for /serv/website/www/ is 775. Could that be the problem? I would change it myself, but I'm not the server admin, so if you think it might be, I will see if he will change it for me. –  Andrew De Forest Aug 13 '12 at 17:57
1  
Yes the group shouldn't be writable. As a simple rule of thumb have 0755 for directories and 0644 for files, at least in the dev environment. It's as Iain said but he didn't read that the permissions on test.php are 0644, so the next best guess is the directory its in are group writable which apache doesn't like. This can be configured within Apache but I don't have much knowledge about that. –  Jay Aug 13 '12 at 18:11
add comment

The error message says that test.php is group writeable. Try removing the g:w permission from the file

chmod g-w test.php
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.