nospa

Well-Known Member
Apr 23, 2012
110
0
66
cPanel Access Level
Reseller Owner
I'm planning a migration to suPHP and the changing of ownership of files on a shared server of over 200 accounts is the one part causing me a headache. I don't allow shell access on a permanent basis to the server but I'm still concerned about doing a recursive shown.

I don't suppose the above steps are scripted up anywhere are they as they do appear to be the safest method...
I have the same headache...
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,212
363
on several other accounts there is a folder on the same level as public_html to which an external user uploads xml files which are then processed by a script on that account

so /home/account/xmlupload

what ownership and permissions should be set for these folders?
You should be able to configure the ownership of the directory to the account username for both group and user ownership. Standard 0755 permissions should apply here. Are you having an issue when using that format?

Thank you.
 

dannymichel

Member
Aug 13, 2013
21
0
1
cPanel Access Level
Root Administrator
I posted this recently in another thread, so I'll reply with the steps I noted there for switching to suPHP. Of note, only use these steps if going to suPHP (do not process these if you are on DSO).

- Change all permissions for folders from 777 to 755

Code:
find /home/*/public_html -type d -exec chmod 755 {} \;
- Change all permissions for files from 666 to 644

Code:
find /home/*/public_html -type f -exec chmod 644 {} \;
- Fix ownership to public_html contents to user:user (rather than user:nobody), but keep top level of public_html as user:nobody

See this location for why to be careful about using a recursive chown to fix these ownership issues. Use the steps noted at this post as a guide for how to fix such ownership issues.

- Remove any php_value and php_flag entries in .htaccess files as they will produce an Internal Server Error if in an account's .htaccess file. Here are the commands to find all such files:

Code:
find /home -type f -name '.htaccess' -exec grep -Hrn 'php_value' '{}' \;
find /home -type f -name '.htaccess' -exec grep -Hrn 'php_flag' '{}' \;
After those php_flag and php_value lines have been removed from any .htaccess, then any accounts needing the values set in their own php.ini file could be done using:

Code:
cp /usr/local/lib/php.ini /home/username/public_html/php.ini
chown username:username /home/username/public_html/php.ini
Then edit the php.ini file to change to the new values, and point the .htaccess on that account to use that php.ini file:

Code:
suPHP_ConfigPath /home/username/public_html/
In these examples, replace username with the actual cPanel username.

Also, under FCGI for the RAM usage, you could have used FcgidMaxRequestInMem to limit those PHP processes from using so much memory:

mod_fcgid - Apache HTTP Server Version 2.5

There are several other limiters there. For DSO and suPHP, you can use RLimitMEM to limit memory:

core - Apache HTTP Server Version 2.2

If your RAM usage is this high, either limiting memory usage or tracking down the account(s) causing it would be in order.
im getting
find: `/home/*/public_html': No such file or directory
 

sami.s

Registered
Jan 14, 2016
3
0
1
USA
cPanel Access Level
Root Administrator
I followed all the advice here, but I still get log errors in suphp_log for every php file served, such as:

[Tue Mar 15 10:35:05 2016] [info] Executing "/home/admin/public_html/somesite.com/index.php" as UID 1001, GID 1001


Any ideas what can be causing this?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,212
363
[Tue Mar 15 10:35:05 2016] [info] Executing "/home/admin/public_html/somesite.com/index.php" as UID 1001, GID 1001
The "[info]" entry suggests it's information as opposed to an error message. Are your PHP files loading when accessed via a web browser?

Thank you.