Skip to main content

Php version for user home directory

Comments

9 comments

  • Gur50
    Update *solved* : Running command like this has solved the issue.
    scl enable ea-php70 'php -v' scl enable ea-php70 'composer --version'
    0
  • Gur50
    Update : Putting .htaccess files at /home/username solving php version for path like that :
    # php -- BEGIN cPanel-generated handler, do not edit # NOTE this account's php is controlled via FPM and the vhost, this is a place holder. # Do not edit. This next line is to support the cPanel php wrapper (php_cli). # AddType application/x-httpd-ea-php70 .php .phtml # php -- END cPanel-generated handler, do not edit
    Commenting "#" line is doing the trick, without commenting apache returns 500 at public_html
    # AddType application/x-httpd-ea-php70 .php .phtml
    0
  • cPanelMichael
    Hello, This behavior is by design. There is no mechanism for configuring a specific PHP version in an account's home directory because PHP is served out of the document root paths (e.g. /home/$user/public_html). You can copy the entry in the .htaccess file from the public_html directory to the .htaccess file within the account's home directory if you'd like to set a PHP version in the "/home/$username" path. For example, here's how it'd look for PHP 7:
    # Set the "ea-php70" package as the default "PHP" programming language. AddType application/x-httpd-ea-php70 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit
    Regarding php.ini behavior, please see the following post: EA4 php.ini/local.ini behavior Thanks!
    0
  • Gur50
    Hello, This behavior is by design. There is no mechanism for configuring a specific PHP version in an account's home directory because PHP is served out of the document root paths (e.g. /home/$user/public_html). You can copy the entry in the .htaccess file from the public_html directory to the .htaccess file within the account's home directory if you'd like to set a PHP version in the "/home/$username" path. For example, here's how it'd look for PHP 7:
    # Set the "ea-php70" package as the default "PHP" programming language. AddType application/x-httpd-ea-php70 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit
    Regarding php.ini behavior, please see the following post: EA4 php.ini/local.ini behavior Thanks!

    Thanks, Michael.
    0
  • asmithjr
    I have a problem after using this method. I get Internal Server error 500. I removed the .htaccess and used the WHM Set PHP version and get the same thing. I've checked the .htaccess and it has what Michael has in the post above yet I get the error.
    0
  • engrossweb
    Have you checked it's permission and ownership. Perhaps that could have incorrect causing internal error.
    0
  • asmithjr
    Yes, the group that installed it had the directories as 777 and files as 666 but I run suPHP so I modified to 755 and 644 but that did not help.
    0
  • engrossweb
    I think then it should be coding problem in your .htaccess. Check the apache error logs for the relevant domain. I hope you will get clue for the error.
    0
  • cPanelMichael
    Hello @asmithjr, Could you let us know the specific output to /usr/local/apache/logs/error_log when you encounter the 500 internal server error code in your browser? Thank you.
    0

Please sign in to leave a comment.