Understanding suExec, permissions, and the account php runs under

ladydi711

Well-Known Member
Sep 4, 2001
140
6
318
Hi,

I have a customer using Wordpress Duplicator to install/migrate a site.

I am using suExec, so I understood that php runs under the user account name.

The users public_html directory pemissions is:

drwxr-x--- accountname:nobody

The only way I can get the Duplicator program to sucessfully test/install is by changing permissions to:
drwxrwx---

Which makes me believe that php is running under nobody as log files are created owned by nobody:nobody.

EasyApache resets the public_html permissions back to drwxr-x---. So, I have been battling permissions each time I need to add a new module for the site to function.

Do I have something not configured properly? Or am I not understanding how this should be working?

Thanks in Advance!
Diane
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
I am using suExec, so I understood that php runs under the user account name.
suPHP is the PHP handler you should use to ensure PHP runs as the account username. This is not the same thing as "suExec".

Thank you.
 

ladydi711

Well-Known Member
Sep 4, 2001
140
6
318
Thanks for the clarification!

I just reviewed my EasyApache profile, and I do indeed have suPHP/mod_suphp enabled.

What else can I do to verify this setup?

Thanks,
Diane
 

HostingH

Well-Known Member
Jan 13, 2008
125
17
68
cPanel Access Level
Root Administrator
To check your current PHP configuration please use following command

/usr/local/cpanel/bin/rebuild_phpconf --current

To enable SuPHP, simply execute the following command:

# /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Check to ensure suPHP is configured as your default handler for PHP in:

"WHM Home » Service Configuration » Configure PHP and suEXEC"

Thank you.
 

ladydi711

Well-Known Member
Sep 4, 2001
140
6
318
Thanks again for the info.

I remember now. I changed from suPHP to dso after the migration to this server, as there were some sites using php directives in the .htaccess file. At the time, that seemed the quickest way to get the sites up and running.

I may re-think that now, and plan for a migration back to suPHP, but at least I understand now!

Thanks again!
Diane
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
cPanel Access Level
DataCenter Provider
SuPHP is definitely easier for servers with multiple sites, as PHP runs as the user, and it avoids permissions issues.

If you need to change PHP settings for a single site, rather than change them in .htaccess (as you did with DSO but discovered does not work with SuPHP) you can simply give the user thier own php.ini file and change their settings in that file. Simply create /home/username/public_html/php.ini (you can copy /usr/local/lib/php.ini to that location), and add this to the users main .htaccess file in public_html:

Code:
suPHP_ConfigPath /home/username/public_html 
<Files php.ini> 
order allow,deny 
deny from all 
</Files>