Change php 5.6 to 7.1 for command line or terminal on Hostgator

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 7.1 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 7.1.x if you have done it right.