nickNix

Registered
Feb 11, 2016
3
0
1
Canton Ohio
cPanel Access Level
Root Administrator
When changing the value on a user account from inherit to ea-php56 I am receiving the follow cPanel exception:



Code:
Error: (XID qak5rh) The system failed to apply the“ PHP” version to“ domain.com”: Cpanel::Exception::IO::FileOpenError / (XID pukb88) The system failed to o
pen the file“ / home / domain / public_html / .htaccess”
for reading and writing because of an error: Permission denied at / usr / local / cpanel / Cpanel / Exception.pm line 183.
 Cpanel::Exception::new("Cpanel::Exception::IO::FileOpenError", HASH(0x674d758)) called at / usr / local / cpanel / Cpanel / Exception.pm line 75 
 Cpanel::Exception::__create("IO::FileOpenError", HASH(0x674d758)) called at / usr / local / cpanel / Cpanel / WebServer / Supported / apache / Htaccess.pm 
 line 186 Cpanel::WebServer::Supported::apache::Htaccess::_internal_set_handler(Cpanel::WebServer::Supported::apache::Htaccess = HASH(0x6697018), "handler", 
 Cpanel::WebServer::Supported::apache::Handler::inherit = HASH(0x66ef978), "lang", Cpanel::ProgLang::Supported::php = HASH(0x65a07d8), "vhost", "domain.
 com", "userdata", Cpanel::WebServer::Userdata = HASH(0x65625d0), ...) called at / usr / local / cpanel / Cpanel / WebServer / Supported / apache / Htaccess.
 pm line 222 Cpanel::WebServer::Supported::apache::Htaccess::__ANON__() called at / usr / local / cpanel / Cpanel / WebServer / Supported / apache / Htaccess
 .pm line 228 Cpanel::WebServer::Supported::apache::Htaccess::set_handler(Cpanel::WebServer::Supported::apache::Htaccess = HASH(0x6697018), "lang", 
 Cpanel::ProgLang::Supported::php = HASH(0x65a07d8), "userdata", Cpanel::WebServer::Userdata = HASH(0x65625d0), "vhost", "domain.com", "package", "inherit", 
 ...) called at / usr / local / cpanel / Cpanel / WebServer / Supported / apache.pm line 872 Cpanel::WebServer::Supported::apache::__ANON__(
 Cpanel::Exception::IO::FileOpenError = HASH(0x674d698)) called at / usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.
 pm line 103 Try::Tiny::
    try (CODE(0x6697048), Try::Tiny::Catch = REF(0x6699278)) called at / usr / local / cpanel / Cpanel / WebServer / Supported / apache.pm line 878 
    Cpanel::WebServer::Supported::apache::set_vhost_lang_package(Cpanel::WebServer::Supported::apache = HASH(0x66b7540), "vhost", "domain.com", "lang", 
    Cpanel::ProgLang::Supported::php = HASH(0x65a07d8), "package", "inherit", "userdata", Cpanel::WebServer::Userdata = HASH(0x65625d0), ...) called at / 
    usr / local / cpanel / Cpanel / WebServer.pm line 450 Cpanel::WebServer::__ANON__(Cpanel::Exception::IO::FileOpenError = HASH(0x674d500)) called at / 
    usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.pm line 103 Try::Tiny::
    try (CODE(0x6694b10), Try::Tiny::Catch = REF(0x6694ac8)) called at / usr / local / cpanel / Cpanel / WebServer.pm line 455 
    Cpanel::WebServer::set_vhost_lang_package(Cpanel::WebServer = HASH(0x64517a0), "vhost", "domain.com", "lang", Cpanel::ProgLang::Supported::php = HASH(
    0x65a07d8), "user", "domain", "package", "ea-php56", ...) called at / usr / local / cpanel / Cpanel / WebServer.pm line 529 
    Cpanel::WebServer::__ANON__() called at / usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.pm line 80 eval {...
    }
called at / usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.pm line 71 Try::Tiny::
    try (CODE(0x65d24f8), Try::Tiny::Catch = REF(0x65a08e0)) called at / usr / local / cpanel / Cpanel / WebServer.pm line 535 
    Cpanel::WebServer::set_vhost_lang_packages(Cpanel::WebServer = HASH(0x64517a0), "user", "domain", "vhosts", ARRAY(0x65a0298), "lang", 
    Cpanel::ProgLang::Supported::php = HASH(0x65a07d8), "package", "ea-php56", ...) called at / usr / local / cpanel / Whostmgr / API / 1 / Lang / PHP.pm 
    line 137 Whostmgr::API::1::Lang::PHP::__ANON__() called at / usr / local / cpanel / Cpanel / AccessIds / ReducedPrivileges.pm line 99 eval {...
    }
called at / usr / local / cpanel / Cpanel / AccessIds / ReducedPrivileges.pm line 99 Cpanel::AccessIds::ReducedPrivileges::call_as_user(CODE(0x65d1da8), 
501, 501) called at / usr / local / cpanel / Whostmgr / API / 1 / Lang / PHP.pm line 143 Whostmgr::API::1::Lang::PHP::php_set_vhost_versions(HASH(
0x466c660), HASH(0x465bb90), HASH(0x6554f10)) called at whostmgr / bin / xml - api.pl line 2742 whostmgr::bin::xml_api::__ANON__(HASH(0x465bb90), HASH(
0x466c660), HASH(0x6554f10), CODE(0x65400c8)) called at / usr / local / cpanel / Whostmgr / API / 1 / Data / Wrapper.pm line 218 
Whostmgr::API::1::Data::Wrapper::__ANON__() called at / usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.pm line 80 
eval {...
}
called at / usr / local / cpanel / 3 rdparty / perl / 514 / lib64 / perl5 / cpanel_lib / Try / Tiny.pm line 71 Try::Tiny::
    try (CODE(0x644db50), Try::Tiny::Catch = REF(0x65a0130)) called at / usr / local / cpanel / Whostmgr / API / 1 / Data / Wrapper.pm line 237 
    Whostmgr::API::1::Data::Wrapper::execute_internal(CODE(0x6554cd0), HASH(0x466c660), HASH(0x6554f10), HASH(0x644dda8), CODE(0x65400c8)) called at 
    whostmgr / bin / xml - api.pl line 2893 whostmgr::bin::xml_api::runapp("php_set_vhost_versions", HASH(0x6554f10), HASH(0x465c508), 0, CODE(0x65400c8)) 
    called at whostmgr / bin / xml - api.pl line 2675 whostmgr::bin::xml_api::script(CODE(0x65400c8), "-json", "./php_set_vhost_versions") called at 
    whostmgr / bin / xml - api.pl line 2628
Code:
/etc/redhat-release:CentOS release 6.7 (Final)
/usr/local/cpanel/version:11.54.0.14
/var/cpanel/envtype:standard
CPANEL=release
Server version: Apache/2.4.18 (cPanel)
Server built:   Feb  4 2016 13:01:27
PHP 5.6.18 (cli) (built: Feb  9 2016 19:00:16)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
mysql  Ver 14.14 Distrib 5.6.29, for Linux (x86_64) using  EditLine wrapper
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
At a guess I'd say the ownership, permissions, or file attributes are wrong. When we make changes to files controlled by a non-privileged user, we do so as the user. Therefore if ownership, permissions, or file attributes would prevent the user from changing a file, it will cause an error.

On the file in question:

1. What is the output of `ls -lah /home/user/public_html/.htaccess`?
2. What is the output of `lsattr /home/user/public_html/.htaccess`?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
I have the same issue, but need to make this change on 80 domains so is there an automated way to update the htaccess for all domains to 644?
Hello @digitaliway,

You can use a command like this to list all .htaccess files under /home without 0644 permissions:

Code:
find /home -type f ! -perm 0644 -name .htaccess
You could then run the command again, adding an exec action (e.g. -exec chmod 644 {} \;) to change the permissions on all files in the output. However, I don't recommend running such a command because it's possible permissions are not set to 644 for a valid reason (e.g. the account is suspended). Instead, you may simply want to review each .htaccess file in the output from the initial command to determine if you should change the permissions.

Thank you.
 

digitaliway

Active Member
Feb 17, 2015
28
2
53
cPanel Access Level
Root Administrator
thank you for the command. I know each of these clients individually on the server so I know we are good to go with permissions.
I needed to implement PHP-FPM and saw no other way but to specify php56 and then implement the PHP-FPM to ON.

I used the below command after looking at yours and it work fine:
find /home/*/public_html -maxdepth 1 -type f ! -perm 0644 -name .htaccess -exec chmod 644 {} \;
 
  • Like
Reactions: cPanelMichael