Php version for user home directory
Hi, system information is :
Os : Centos 7
Whm : 60 (build 15)
Easyapache4
With easyapache having both phpea56 and phpea70 versions on system.
System default is phpea56.
So I have changed php version for 1 of my user to phpea70.
It works fine under public_html but in in home directory (/home/username/) php shows 5.6.
So application needs to deployed at /home/username/application_name and it needs php 7.
I put and .htaccess file at location /home/username/application_name with this directive,
Firstly is this right approaching or should I set it differently? and second, i need php directive "allow_url_fopen" "on" here, but even couldn't figure out how? Thanks. Notes : Whm -> Software -> MultiPHP INI Editor -> eaphp70 -> allow_url_fopen -> enabled On cPanel MultiPHP INI Editor shows : Path /home/survivorfan/php.ini PHP Version ea-php70 allow_url_fopen = On
AddType application/x-httpd-ea-php70Firstly is this right approaching or should I set it differently? and second, i need php directive "allow_url_fopen" "on" here, but even couldn't figure out how? Thanks. Notes : Whm -> Software -> MultiPHP INI Editor -> eaphp70 -> allow_url_fopen -> enabled On cPanel MultiPHP INI Editor shows : Path /home/survivorfan/php.ini PHP Version ea-php70 allow_url_fopen = On
-
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 .phtml0 -
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 -
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 -
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 -
Have you checked it's permission and ownership. Perhaps that could have incorrect causing internal error. 0 -
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 -
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 -
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.
Comments
9 comments