Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CHange php 5.4 to 5.5 on Hostgator

Currently on composer install I get the error need 5.5.9 but using 5.4 but on Hostgator cpanal it's set as 5.5

On php -v I get

PHP 5.4.45

On php --ini I get

Configuration file (php.ini) Path: /opt/php54/lib

When going into /opt/ There is a php54, php55 and php56

How do I change my version to 5.5

I saw the following example on this link

$ php -v
PHP 5.4.x (cli) ...
$ set PATH="/usr/lib64/php5.6/bin:$PATH"
$ php -v
PHP 5.6.x (cli) ...

But when going into /usr/lib64 there's no php5.6

On my index file in the webserver I did a phpinfo() and it's set as 5.5

Anyone got any ideas

like image 563
Ninja Avatar asked Dec 10 '22 19:12

Ninja


1 Answers

On my hostgator shared hosting, the php 5.6 executable is located at /opt/php56/bin/php

You can use ls /opt to see if the php version folders exist.

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

alias php='/opt/php56/bin/php'

You might have to logout and log in again if you dont see a change.

Now, when you use php -v it should say 5.6.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.

like image 181
Andy Avatar answered Dec 27 '22 06:12

Andy