skip to Main Content

Hostgator customer support is absolutely useless. I have been trying for 3 days to update my PHP version so I can install Laravel 5.6. I tried the PHP Selector plugin in cPanel which appears to be the only means of updating the PHP version.

Even after updating every directory to 7.1 in the PHP Selector plugin it still is not working. I called tech support 3 days ago and talked to 3 different representatives and each in a roundabout way told me there was nothing they could do about it and awkwardly apologized.

Then I requested they reset my server and they said I had to wait for email confirmation which took 2 days to arrive. Reset my server to default settings and default files. Tried the PHP Selector again with no luck. Called customer support, the lady told me she updated it herself and to wait to see it on my end. “It should happen any minute.” No change.

I’m checking my PHP version with my SSH and the php -v command. It always says I have PHP 5.4 and when trying to use composer create-project --prefer-dist laravel/laravel=5.6 it returns an error that my PHP version is 5.4 and incompatible.

I’m not ranting, I just want to explain the full extent of everything I’ve tried and how customer support isn’t much of an option at this point.

Does anyone have any personal experience updating PHP on Hostgator? I have a shared account. Thanks.

5

Answers


  1. On shared hosting accounts, you likely need to provide the full path to PHP and won’t be able to rely on the system binaries, since they likely have multiple versions of PHP installed and if they are running Enterprise Linux 7, the system binary will almost always be PHP 5.4.

    Using the info here: https://support.hostgator.com/articles/specialized-help/technical/linux-application-paths-what-is-the-path-to, I can assume the path to 7.1 would be /opt/php71/bin/php.

    So download composer.phar (or replace composer.phar with the system path to composer), then run:

    /opt/php71/bin/php composer.phar create-project --prefer-dist laravel/laravel=5.6
    
    Login or Signup to reply.
  2. To expand on the above response, the command line (cli) version of php is not necessarily the same version that is selected in cpanel. You can use ls /opt to see if the php version folders exist.

    So if you want to update your php command with 7.1 you should edit your ‘~/.bash_profile’ and append the following line:

    alias php='/opt/php71/bin/php'
    

    You might have to logout and log in again if you don’t see a change or you can type ‘. ~/.bash_profile’

    Now, when you use php -v it should say7.0.x if you have done it right.

    This works the same with 7.0 and any other php versions should be located in the same dir.

    Login or Signup to reply.
  3. For what it’s worth, adding to @Devon ‘s answer, in your HostGator cPanel, make sure you select php 7.1 (not Edge) from within your public_html directory. That is what finally got it working for me.

    Login or Signup to reply.
  4. I found this post with the same problem and it was because I didn’t click the ‘public_html’ folder in the PHP selector then I updated it to 7.1. Jasper from live chat support via HostGator was able to help and solve my problem. It seemed obvious after he told me but I totally spaced on it and was stuck so if anyone else is reading this like I did – maybe this will help you too haha

    Login or Signup to reply.
  5. Simply modifying HTACCESS file:

    As explained in another answer over here, use the following code in htaccess file (lines with # at beginning are commented):

      # Use PHP 5.6
    #AddHandler application/x-httpd-php56 .php
    #<IfModule mod_suphp.c>
    #    suPHP_ConfigPath /opt/php56/lib
    #</IfModule>
    
      # Use PHP 7.1
    #AddHandler application/x-httpd-php71 .php
    #<IfModule mod_suphp.c>
    #    suPHP_ConfigPath /opt/php71/lib
    #</IfModule>
    
      # Use PHP 7.2 (appears to have no MySQL extension)
    #AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
    #<IfModule mod_suphp.c>
    #    suPHP_ConfigPath /opt/php72/lib
    #</IfModule>
    
      # PHP 7.3 (appears to have no MySQL extension either)
    #<IfModule mime_module>
    #  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
    #</IfModule>
    
      # NEW PHP 7.4 (automatically added by Hostgator to new domains since ~Jan 2021)
    <IfModule mime_module>
      AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
    </IfModule>
    

    The additional commented lines are for newer versions, but only 7.1 appears to have MySQL extension (until now, July 2017).

    NOTE: Since March 2021, older versions of PHP (than 7.4) will no longer be supported. As well, Hostgator has added a "MultiPHP Manager" so you can manage this from a less complicated section in cPanel

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search