Need Help 🛬
Framework - Laravel
Hosting - Hostgator
Problem Statement :- I need to run the 'composer update'. All dependencies required minimun php -v of 5.5.9. I have manualy Upgrade the php version of Project directory to 5.6 from cpanel using 'Php configration' plugin. But when i logged in using ssh, then i got the php -v of 5.4.45. Ofcourse It targeting the deafult php version of the server. Is there any way to update php to 5.6 or above on ssh also. No root user access. No help from support team also. ðŸŽ
If you use code that is outdated and not supported in the newer version of PHP, then your site will give errors and may stop working altogether. For example, if you haven't updated your CMS to the latest version, or if your website uses custom code, for which an update isn't readily available.
Update PHP for WindowsRun php -v from the command line to check your PHP version. If you don't want to update PHP manually, you can use the Chocolatey package manager to install and update PHP version for you. Chocolatey is a package manager for Windows computers, it works like Homebrew for Mac computers.
Using a PRO/Shared Host (tested in Hostgator.com.br) you can do this in SSH (change the usercpanel to your own):
vim /home/usercpanel/.bashrc
In the next page, if it's blank, insert the values:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
Right after, you will put (you can change the php version: 71, 72, 73 or 74):
alias php='/opt/cpanel/ea-php74/root/usr/bin/php'
export PATH="/opt/cpanel/ea-php74/root/usr/bin:$PATH"
Save the changes and exit.
Now, insert this code to load the new config (change the usercpanel to your own):
source /home/usercpanel/.bashrc
And, insert this code to verify if the alias has been loaded.
alias | egrep 'php'
And then, check if the path is being displayed in the PATH variable:
echo $PATH | egrep '/opt/cpanel/ea-php74/root/usr/bin'
DONE! Tested and working fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With