Directadmin Internal Server Error Suphp
Contents |
work under ~username when using suPhp (custombuild)Last Modified: Sep 21, 2012, 2:04 am By default, suPhp is compiled in "paranoid" mode. This means install suphp directadmin that the settings in the user httpd.conf files:suPHP_UserGroup username usernamewill require all directadmin disable suphp php files to be owned by username or suPhp will throw a "500 Internal Server Error". This suphp 500 internal server error does not apply to domains, when used normally, because each domain has it's own VirtualHost with the suPHP_UserGroup inside it using the correct settings. The ~username (UserDir) method will fail no user or group set - set suphp_usergroup cpanel in paranoid mode, because there is not a virtualhost for each ~username path, and no suPHP_UserGroup settings for each user, hence you get the 500 error. The solution to this is to compile suPhp in "owner" mode instead of "paranoid" mode. To do that, run these commands.cd /usr/local/directadmin/custombuild mkdir -p custom/suphp cp -fp configure/suphp/configure.suphp custom/suphp/configure.suphp perl -pi -e 's/paranoid/owner/'
No User Or Group Set Set Suphp_usergroup Apache
custom/suphp/configure.suphp ./build clean ./build suphp cd /usr/local/directadmin/data/templates/custom cp -f ../virtual_host* . perl -pi -e 's/suPHP_UserGroup/#suPHP_UserGroup/' virtual_host*.conf perl -pi -e 's/suPHP_UserGroup/#suPHP_UserGroup/' /etc/httpd/conf/httpd.conf perl -pi -e 's/suPHP_UserGroup/#suPHP_UserGroup/' /etc/httpd/conf/extra/httpd-directories-*.conf echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queueWhich will change all references of suPHP_UserGroup to #suPHP_UserGroup, basically, just commenting them out. Update: Sept 21, 2012 A new method was discovered which is much simpler than changing how suPhp works. Until it's fully supported in DA, and if you'd like to try it (without needing the above changes), do the following: 1) Edit:/etc/httpd/conf/extra/httpd-includes.conf 2) Add the code for each User you want this to apply to:
state "CLI", php scripts run as the apache user. If any files are uploaded or created with php,
Suphp_configpath
then the files will be saved as the apache user. If you'd like to have php run as the system user instead of "apache", then you'd need to install suPhp. suPhp is an option that can be set when installing the custombuild script: http://files.directadmin.com/services/custombuild/1.1 To do so, type, after the "./build update_data" command, use this:./build set php5_cgi yes ./build https://help.directadmin.com/item.php?id=176 set php5_cli no ./build all d ./build rewrite_confs Note that all logs for suPhp are stored in: /var/log/suphp.log If you get any "Internal Server Error" messages, check the suphp.log to see why. Usually, things like writeable by "all" or "group" ... or having the incorrect ownership of the file would cause this. Note that directories cannot be set to https://help.directadmin.com/item.php?id=197 777 with suPhp. 755 is usually the max permissions for directories (you don't need 777 with suphp since php writes as the User). Files should be no more than 644, but php files can be 600 since they're read in by the User (security benefit with suPhp). All files/folders must be chowned to the user, and not to apache. Important: Note that the safe_mode and open_basedir settings in Admin Level -> Php Safemode Config only apply to php CLI, not suPhp. If you want open_basedir and safe_mode, use this guide to enable a per-user php.ini file. You may need to rewrite the webapps php scripts to reset the ownerships if you get internal server errors with them, eg:./build roundcube ./build squirrelmail ./build phpmyadmin Related Helpfiles Resetting permissions and ownership on all DA related system files. Allow php scripts to work under ~username when using suPhp (custombuild) Setup a per-user php.ini to allow open_basedir with suPhp Basic system security How to prevent Users from seeing in each other's public_html folders Using both php4 and php5 at the
this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link https://www.forum.directadmin.com/showthread.php?t=42683 above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 9 of 9 Thread: Since suPHP, php error's into a HTTP-500 Thread Tools Show Printable Version Email this Page… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-22-2012,07:55 AM #1 BlueCola View Profile View Forum Posts Verified User Join Date Jan internal server 2012 Posts 69 Since suPHP, php error's into a HTTP-500 I updated last week to suPHP. I was just making a website, when I noticed that when I make a error in php, I didnt get 'Expected T_ELSE', but instead i did get a HTTP 500 error. I really don't like this, because you need to check the /var/log/httpd/domain/domain.error.log to see what's wrong. Also, customers don't internal server error have access to that folder ofcourse, so they can't see their error's. What can I do to fix this? Is there a possibility to write logs to the home/user map instead, or just show the PHP error on the page instead of 500? Reply With Quote 01-23-2012,12:17 AM #2 SeLLeRoNe View Profile View Forum Posts Visit Homepage Crazy Network Join Date Oct 2004 Location London, UK Posts 6,249 Probably is something now blocked in .htaccess. Check if your user have an .htaccess file and post here. Probably is FollowSymLink directive Regards SeLLeRoNe - Andrea Iannucci DevOps Engineer - System Administrator If you need my support write me an E-Mail to Support@CrazyNetwork.it Reply With Quote 01-23-2012,12:00 PM #3 BlueCola View Profile View Forum Posts Verified User Join Date Jan 2012 Posts 69 No, that isn't the problem. My script is: PHP Code: echo"Pleasegivemeanerror!
With this script, I trigger an internal 500 error. If I edit it to: PHP Code:
"
echo"Canyoudothatforme?;
?> echo"Pleasegivemeanerror!
";
echo