SOLVED PHP public_html permissons

mreidgs

Member
Nov 7, 2017
12
2
3
Calgary
cPanel Access Level
Root Administrator
It seems like PHP does not have write permissions to account public_html directories by default.

I create an account from within WHM, upload an importbuddy.php backup to restore the site on the server. I get:

Error #224834 . This directory, `/home/cmitest/public_html/`, is not write enabled according to the server. Please verify proper write permissions to continue. If this persists, contact your web hosting provider and tell them that is_writable("/home/cmitest/public_html/") returns FALSE in PHP.

I have to manually change the permissions to 755 on public_html for it to work, then change it back again after. This didn't used to be the case, only started happening recently.

Running CENTOS 6.9 virtuozzo, WHM v68.0.9
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463
Hello,

Check to see if "Enable File Protect" is enabled under the "Security" tab in "WHM >> Tweak Settings". The File Protect functionality will check the permissions and ownership values on each user account's home and public_html directories and each addon domain's DocumentRoot directory and then set the values accordingly. Note that rather than disabling this option, you may want to consider switching to a different PHP handler:

PHP Handlers - EasyApache 4 - cPanel Documentation

Thank you.
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
87
78
cPanel Access Level
DataCenter Provider
If you run multiple sites on a server, for security reasons you should ALWAYS use file protect, and public_html itself should be 750. Never should you set public_html itself as 755. Check your php handling, apache MPM, etc as necessary to make it work.
 
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463
Hello,

It looks like it's CGI that's available. You can install additional handlers using "WHM >> Software >> EasyApache 4" if you want to use a different handler. That said, check out the section on CGI for information on how PHP scripts are executed when it's enabled:

PHP Handlers - EasyApache 4 - cPanel Documentation

Thank you.
 

mreidgs

Member
Nov 7, 2017
12
2
3
Calgary
cPanel Access Level
Root Administrator
There are some differences between the 2 servers I have, both are with GoDaddy.

One is the latest version of cpanel, but hasn't been migrated to EasyApache4, I ran the migration last week but I broke some Wordpress sites so I had to revert back. It has the option for configure php and suexec. The php handler is set to suphp and suexec is set to on.

The other server is cpanel version 66.0.29, but has been migrated to EasyApache4, so it has the Multiphp option. The only option I have for php handler there is cgi.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463
The other server is cpanel version 66.0.29, but has been migrated to EasyApache4, so it has the Multiphp option. The only option I have for php handler there is cgi.
You can install additional handlers such as suPHP using "WHM >> Software >> EasyApache 4". The "mod_suphp" package is found under the "Apache Modules" section.

Thank you.