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.

confusion about which php version website is being served by

Discussion in 'EasyApache' started by Mangoose, Apr 13, 2017.

Tags:
  1. Mangoose

    Mangoose Active Member

    Joined:
    Aug 5, 2014
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi

    I am using EA4 on my Cpanel server and I work with MultiPHP Manager.
    One account is being totally served by PHP 5.6 while others should be served by PHP 7.0 according to the settings by the MultiPHP Manager in those hosting accounts which need PHP 7.0

    However when I check if indeed this is the case by adding a file which should reveal to me what PHP version is served
    PHP:
    <?php phpinfo();?>
    version.php

    Then I see PHP 5.6.30 and not PHP 7.0, why is that and is how can I really make sure that PHP 7.0 is served to this website?

    Thanks in advance

    Anthony
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,285
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Are you using any third-party applications such as LiteSpeed or PHP Selector with CloudLinux on this system?

    Thank you.
     
  3. Mangoose

    Mangoose Active Member

    Joined:
    Aug 5, 2014
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Michael, I am not on CloudLinux just EA4 and no I am not using LiteSpeed or PHP Selector on my system.

    I am using xVarnish on this server and APCu but the latter is not used by any Cpanel account.

    Yours truly,
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,285
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the contents of the .htaccess file in the document root of the affected website?

    Thank you.
     
  5. Mangoose

    Mangoose Active Member

    Joined:
    Aug 5, 2014
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Michael,

    The content of the .htaccess file is you asked for
    Code:
    DirectoryIndex index.html index.php
    
    
    <IfModule mod_deflate.c>
        # Compress HTML, CSS, JavaScript, Text, XML, fonts
        AddOutputFilterByType DEFLATE application/javascript application/x-javascript text/javascript application/json
        AddOutputFilterByType DEFLATE application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf font/opentype font/otf font/ttf application/x-woff application/x-font-woff
        AddOutputFilterByType DEFLATE text/css text/html text/plain
    
        <IfModule mod_headers.c>
            # Remove browser bugs (only needed for really old browsers)
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            BrowserMatch ^Mozilla/4\.0[678] no-gzip
            BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
            Header append Vary User-Agent
        </IfModule>
    </IfModule>
    
    <IfModule mod_headers.c>
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|css|png|gif|ico|jpe?g)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    # Cache all images for 2 months
    <IfModule mod_expires.c>
        <FilesMatch "\.(jpg|jpeg|png|gif|tiff|bmp|js|css)$">
            ExpiresActive on
            ExpiresDefault "access plus 2 months"
        </FilesMatch>
    </IfModule>
    
    <IfModule mod_headers.c>
        <filesMatch "\.(gif|png|jpg|jpeg|ico|js|css)$">
            Header set Cache-Control "max-age=1209600"
        </filesMatch>
    </IfModule>
    
    
    #Expire Header
    <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
    ExpiresDefault "access plus 2 months"
    </FilesMatch>
    
    #Gzip
    <ifmodule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
    </ifmodule>
    
    
    <IfModule mod_rewrite.c>
    RewriteEngine on
    # Please note that RewriteBase setting is obsolete use it only in case you experience  some problems with SEO addon.
    # Some hostings require RewriteBase to be uncommented
    # Example:
    # Your store url is http://www.yourcompany.com/store/cart
    # So "RewriteBase" should be:
    # RewriteBase /store/cart
    # RewriteBase /
    Options -MultiViews
    
    
    
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
    RewriteCond %{REQUEST_URI} .*/api/(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .*api/(.*)$ api.php?_d=$1 [L,QSA]
    
    RewriteCond %{REQUEST_URI} \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]
    RewriteCond %{REQUEST_URI} store_closed.html$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*?)\/(.*)$ $2 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L,QSA]
    
    </IfModule>
    
    # This prevents possible problems when downloading files
    <IfModule mod_php5.c>
        php_flag zlib.output_compression Off
    </IfModule>
    
    <IfModule mod_headers.c>
        <IfModule mod_expires.c>
            Header append Vary: Accept-Encoding
            Header unset ETag
            FileETag None
            ExpiresActive On
            ExpiresDefault "access plus 1 month"
            ExpiresByType text/html "access plus 2 months"
            ExpiresByType image/x-icon "access plus 1 year"
            <FilesMatch .*\.css.gz$>
                Header unset ETag
                FileETag None
                ExpiresActive On
                ExpiresDefault "access plus 1 year"
                ForceType text/css
                Header set Content-Encoding: gzip
                Header set Cache-control: private
            </FilesMatch>
            <FilesMatch .*\.js.gz$>
                Header unset ETag
                FileETag None
                ExpiresActive On
                ExpiresDefault "access plus 1 year"
                ForceType text/javascript
                Header set Content-Encoding: gzip
                Header set Cache-control: private
            </FilesMatch>
        </IfModule>
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    ServerSignature Off
    
    <IfModule mod_expires.c>
    
        ExpiresActive on
        ExpiresDefault                                      "access plus 1 month"
    
      # CSS
    
        ExpiresByType text/css                              "access plus 1 year"
    
    
      # Data interchange
    
        ExpiresByType application/atom+xml                  "access plus 1 hour"
        ExpiresByType application/rdf+xml                   "access plus 1 hour"
        ExpiresByType application/rss+xml                   "access plus 1 hour"
    
        ExpiresByType application/json                      "access plus 0 seconds"
        ExpiresByType application/ld+json                   "access plus 0 seconds"
        ExpiresByType application/schema+json               "access plus 0 seconds"
        ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
        ExpiresByType application/xml                       "access plus 0 seconds"
        ExpiresByType text/xml                              "access plus 0 seconds"
    
    
      # Favicon (cannot be renamed!) and cursor images
    
        ExpiresByType image/vnd.microsoft.icon              "access plus 1 month"
        ExpiresByType image/x-icon                          "access plus 1 month"
    
      # HTML
    
        ExpiresByType text/html                             "access plus 0 seconds"
    
    
      # JavaScript
    
        ExpiresByType application/javascript                "access plus 1 year"
        ExpiresByType application/x-javascript              "access plus 1 year"
        ExpiresByType text/javascript                       "access plus 1 year"
    
    
      # Manifest files
    
        ExpiresByType application/manifest+json             "access plus 1 week"
        ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
        ExpiresByType text/cache-manifest                   "access plus 0 seconds"
    
    
      # Media files
    
        ExpiresByType audio/ogg                             "access plus 1 month"
        ExpiresByType image/bmp                             "access plus 1 month"
        ExpiresByType image/gif                             "access plus 1 month"
        ExpiresByType image/jpeg                            "access plus 1 month"
        ExpiresByType image/png                             "access plus 1 month"
        ExpiresByType image/svg+xml                         "access plus 1 month"
        ExpiresByType image/webp                            "access plus 1 month"
        ExpiresByType video/mp4                             "access plus 1 month"
        ExpiresByType video/ogg                             "access plus 1 month"
        ExpiresByType video/webm                            "access plus 1 month"
    
    
      # Web fonts
    
        # Embedded OpenType (EOT)
        ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
        ExpiresByType font/eot                              "access plus 1 month"
    
        # OpenType
        ExpiresByType font/opentype                         "access plus 1 month"
    
        # TrueType
        ExpiresByType application/x-font-ttf                "access plus 1 month"
    
        # Web Open Font Format (WOFF) 1.0
        ExpiresByType application/font-woff                 "access plus 1 month"
        ExpiresByType application/x-font-woff               "access plus 1 month"
        ExpiresByType font/woff                             "access plus 1 month"
    
        # Web Open Font Format (WOFF) 2.0
        ExpiresByType application/font-woff2                "access plus 1 month"
    
    
      # Other
    
        ExpiresByType text/x-cross-domain-policy            "access plus 2 weeks"
    
    </IfModule>
    
    
     
  6. Mark Shaw

    Mark Shaw Member

    Joined:
    Apr 13, 2017
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    PEI Canada
    cPanel Access Level:
    DataCenter Provider
    Hello Mangoose,

    Please try these instructions that I have for you below.

    1. Login to cPanel
    2. Click the Multi PHP button in the Software section.
    3. Select the version of PHP you want to use from the dropdown.
    4. Select the domains that you would like to be used for this version of PHP.
    5. Click the Update button to save your php configuration.
    6. Check your changes by viewing your setting with PHP info
    If this does not work then please provide a screenshot of the version that is defined under the Multi PHP page, however I believe these instructions will get you fixed up!

    Thanks,
    Mark S.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,285
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It looks like you are missing an entry in your .htaccess file to define the custom PHP version. Did you replace the .htaccess file on the account? If so, try using the steps in the previous post and let us know if that helps.

    Thank you.
     
  8. Mangoose

    Mangoose Active Member

    Joined:
    Aug 5, 2014
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    What entry do you suppose I am missing here ?

    PS Mark's solution is no solution, no offense Mark but what you suggest I do have already tried.
    Yet the results do not indicate that my store is utlizing PHP 7.0
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,285
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    For instance, if the system PHP version configured in "WHM >> MultiPHP Manager" is set to PHP 7.0, and one particular domain name is set to PHP 5.6, then the following entry should exist in the .htaccess file in the document root of that specific domain name:

    Code:
    # 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
    Thank you.
     
  10. Mark Shaw

    Mark Shaw Member

    Joined:
    Apr 13, 2017
    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    PEI Canada
    cPanel Access Level:
    DataCenter Provider
    Hello,

    I did not mean to insult you so sorry if you took it that way. However I meant sometimes a common issue is people forget to click a box or tick a box and that causes it not to work. If you save it in cPanel does it show that version as being used after you save it when you go back in? If it doesn't then the configuration is not saving. Which would explain why it doesn't work.

    Regards,

    Mark S.
     
Loading...

Share This Page