suPHP - 500 Internal Server Error

Started by Administrator, June 13, 2014, 03:26:53 PM

Previous topic - Next topic

Administrator

This error  is usually related to a permissions/ownership issue.
suPHP requires that the files are owned by the user name. Permissions on php files should also be set to 644 (-rw-r-r-), folder permission must be 755.

How to change ownership on the files and folders

Quoteoption no.1. (this will fix all permissions for the user account)
go to CWP menu --> User Accounts -- > Fix Permissions and select user

option no.2.
For one file eg. /home/test/public_html/index.php
chown USERNAME:USERNAME /home/test/public_html/index.php

For all files in /home/test/public_html folder (RECOMMENDED)
chown -R USERNAME:USERNAME /home/test/public_html/*



How to change permissions on the files and folders

For one file eg. /home/test/public_html/index.php
chmod 644 /home/test/public_html/index.php

For all files in /home/test/public_html folder (RECOMMENDED)
cd /home/test/public_html
find . -type f -exec chmod 644 {} \;



If not of the above helps than you can check .htaccess file
you can check, disable, rename .htaccess file as rules inside this file can cause this issue.

You can also tail/monitor error log using command
tail -f /usr/local/apache/logs/error_log

Giba

hello

I did the procedure as described and did not work.

how can I solve the problem?

Administrator

have you checked logs like described in last step?

Giba

In the error log

[Tue Jul 22 22:46:41 2014] [error] [client 10.1.107.11] SoftException in Application.cpp:221: File "/home/mega/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Tue Jul 22 22:46:41 2014] [error] [client 10.1.107.11] Premature end of script headers: index.php


could help?

Administrator

yes this is ownership or file location error.

all files needs to be located in users home folder public_html and need to be chowned as user owner.

Giba

ok

But how do I do that?

'm newbie in this system.

Could you inform me I shall step to setting this up?

Administrator

#6
you have instructions in first post.

for advanced support contact
http://centos-webpanel.com/contact

carmageddon63

 [error] [client 127.0.0.1] Premature end of script headers: phpinfo.php

i give this message.
pls help

Administrator


carmageddon63


tail -f /usr/local/apache/logs/error_log


[root@cwp public_html]# tail -f /usr/local/apache/logs/error_log
[Thu Jul 31 18:00:23 2014] [error] [client 88.246.102.209] SoftException in Application.cpp:221: File "/home/test/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Thu Jul 31 18:00:23 2014] [error] [client 88.246.102.209] Premature end of script headers: index.php
[Thu Jul 31 18:04:25 2014] [notice] caught SIGTERM, shutting down
[Thu Jul 31 18:05:31 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Jul 31 18:05:31 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Thu Jul 31 18:05:32 2014] [notice] Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Thu Jul 31 18:06:04 2014] [error] [client 88.246.102.209] File does not exist: /usr/local/apache/htdocs/img, referer: http://195.244.63.95/
[Thu Jul 31 18:06:04 2014] [error] [client 88.246.102.209] File does not exist: /usr/local/apache/htdocs/favicon.ico




[Thu Jul 31 18:06:12 2014] [error] [client 88.246.102.209] SoftException in Application.cpp:221: File "/home/test/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Thu Jul 31 18:06:12 2014] [error] [client 88.246.102.209] Premature end of script headers: index.php
[Thu Jul 31 18:09:41 2014] [error] [client 88.246.102.209] SoftException in Application.cpp:221: File "/home/test/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Thu Jul 31 18:09:41 2014] [error] [client 88.246.102.209] Premature end of script headers: index.php
[Thu Jul 31 18:09:43 2014] [error] [client 88.246.102.209] SoftException in Application.cpp:221: File "/home/test/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Thu Jul 31 18:09:43 2014] [error] [client 88.246.102.209] Premature end of script headers: index.php
[Thu Jul 31 18:09:44 2014] [error] [client 88.246.102.209] SoftException in Application.cpp:221: File "/home/test/public_html/index.php" is not in document root of Vhost "/usr/local/apache/htdocs"
[Thu Jul 31 18:09:44 2014] [error] [client 88.246.102.209] Premature end of script headers: index.php

Administrator

you need to provide all details about error message which you get in your browser, file permission and ownership including all parent folders.


erm3nda

#12
Quote from: Administrator on July 23, 2014, 03:54:58 PM
yes this is ownership or file location error.

all files needs to be located in users home folder public_html and need to be chowned as user owner.

This is quite confuse to me. I 've read somewhere in that forum like "you must add an alias..." but seems NO alias will work untill you have suPHP installed.

You say "in the same folder". It's that 100% true? I know user it's a must of suPHP, but don't know much about folder permisions.

I have poste same problem in a new thread, phpmyadmin related here http://forum.centos-webpanel.com/aplications/phpmyadmin-alias-error-500-internal-server/

Sorry for duplicity. Search function in forum IS NOT GOOD. It's hard to find certain posts, even if the search words are right.

EDIT: Seems not easy but seems that we can solve. Take a look here http://ubuntuforums.org/showthread.php?t=1753871. Seems we have to edit vHost templates to make it work onthefly for new domains too...

Regards.
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

apmuthu

Please be aware that the instructions in the Ubuntu Forum link above is for debian based builds only and need to be 'adapted' to CentOS/RHEL based systems.

Administrator

all files must be in proper document root (home folder) of the user account or they will not work, this are security features of SuExec.