Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Php version for user home directory

Discussion in 'EasyApache' started by Gur50, Nov 4, 2016.

Tags:
  1. Gur50

    Gur50 Member

    Joined:
    Jul 25, 2014
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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,

    Code:
    AddType application/x-httpd-ea-php70
    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
     
  2. Gur50

    Gur50 Member

    Joined:
    Jul 25, 2014
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
  3. Gur50

    Gur50 Member

    Joined:
    Jul 25, 2014
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Update :

    Putting .htaccess files at /home/username solving php version for path like that :

    Code:
    # 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

    Code:
    # AddType application/x-httpd-ea-php70 .php .phtml
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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:

    Code:
    # Set the “ea-php70” package as the default “PHP” programming language.
    <IfModule mime_module>
      AddType application/x-httpd-ea-php70 .php .php7 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
    Regarding php.ini behavior, please see the following post:

    EA4 php.ini/local.ini behavior

    Thanks!
     
    Gur50 likes this.
  5. Gur50

    Gur50 Member

    Joined:
    Jul 25, 2014
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Thanks, Michael.
     
    cPanelMichael likes this.
  6. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    503
    Likes Received:
    4
    Trophy Points:
    168
    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.
     
  7. engrossweb

    engrossweb Member

    Joined:
    Jan 17, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Have you checked it's permission and ownership. Perhaps that could have incorrect causing internal error.
     
  8. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    503
    Likes Received:
    4
    Trophy Points:
    168
    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.
     
  9. engrossweb

    engrossweb Member

    Joined:
    Jan 17, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    India
    cPanel Access Level:
    Root Administrator
    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.
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page