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!

MutliPHP Version Mismatch in .htaccess

Discussion in 'EasyApache' started by ocbox, Jan 4, 2019.

  1. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    153
    I'm using MultiPHP Manager in cPanel and the domain correctly shows PHP7.2. If I run phpinfo(), I get the correct PHP version 7.2.13. Lastly, MultiPHP INI Editor shows "PHP Version ea-php72"

    Now, inexplicably, the .htaccess file reads:
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php56” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddType application/x-httpd-ea-php56 .php .php5 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit

    2 Questions:
    1. Why is the .htaccess file showing 5.6 but all indications are the site is using 7.2?
    2. How is PHP executing the proper version that is shown in MultiPHP Manager when it's not the version in the .htaccess file?

    To make things more interesting, in the subdomain, the .htaccess information is correct:
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php72” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddType application/x-httpd-ea-php72 .php .php7 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit


    If it's any help, these sites were recently migrated (using the cPanel Transfer tool).
     
  2. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    153
    As an additional note, cPanel's MultiPHP version control seems to work properly for controlling the version, as I explicitly changed to 5.6 and the phpinfo() then showed the correct version. I changed back to 7.2 and phpinfo() again showed the correct version. Meanwhile .htaccess remained 5.6 and the change date of the file was not altered (so, I'm assuming that the file was never changed). Where are these MultiPHP settings being stored?
     
  3. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    153
    So, here's some additional information. It appears that changes to php version made in cPanel are being set in httpd.conf using SetHandler. If this is correct, is there a way to override the PHP version on a per-directory basis (since it appears that the version defined in .htaccess is being disregarded in favor of the httpd.conf version)

    My old server ran mpm prefork and I don't see mod_proxy_fcgi as an option in Apache Modules. My new server is configured for mpm event and mod_proxy_fcgi is enabled. Is that the reason that MultiPHP is being defined in httpd.conf instead of .htaccess?
     
  4. ocbox

    ocbox Member

    Joined:
    Dec 6, 2005
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    153
    OK, for anyone else who runs into this, it appears that if you run PHP-FPM the changes will be made in httpd.conf, if you do not, the changes are made in .htaccess. This is new to me, but I'm guessing that the PHP-FPM needs to route all the request to the fcgi before it reaches .htaccess. Someone let me know if this is wrong or they can enlighten me further.
     
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,440
    Likes Received:
    503
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @ocbox


    This is due to the fact that if you run PHP-FPM it uses it's own configuration files separate from what you'd use normally. The changes are made in one of the PHP-FPM specific configuration files (either globally or locally) and are added to the httpd.conf as an include.

    For example, it has its own list of disabled_functions apart from what's listed in a specific php version's .ini file. This would also affect directives specific to the .htaccess file. The resource here: Tutorial - Managing php.ini directives with PHP-FPM may give you some insight as to how it's functioning globally as well as per account.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice