Specific PHP-CLI version for account
Hi,
I have an account that's set to PHP 5.5 DSO, but PHP-CLI uses system default 5.6, I need that account's PHP-CLI also to use 5.5
I tried to add an alias
at bottom in .bash_profile & .bashrc files in /home/account/ but that didn't seem to work How can I set that account to use a specific PHP-CLI version (change htaccess, php.ini, bash_profile or other files)? Thanks
alias php='/opt/cpanel/ea-php55/root/usr/bin/php'
and
alias php='/usr/local/bin/ea-php55'
at bottom in .bash_profile & .bashrc files in /home/account/ but that didn't seem to work How can I set that account to use a specific PHP-CLI version (change htaccess, php.ini, bash_profile or other files)? Thanks
-
HI @gizmo80 The following documentation on ea4 and the EA PHP CLI Package might be helpful: EasyApache 4 and the ea-php-cli Package - EasyApache 4 - cPanel Documentation If you want to create an alias for that user you'd need to alias it to the path shown here: $ /opt/cpanel/ea-php55/root/usr/bin/php --version PHP 5.5.38 (cli) (built: Aug 28 2018 14:47:03) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
0 -
Hi Lauren, so when I do command /opt/cpanel/ea-php55/root/usr/bin/php --version, it says I also have 5.5.38 I tried changing .bashrc to # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions alias php=/opt/cpanel/ea-php55/root/usr/bin/php
this didn't work file .bash_profile contains# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
which file should I change and how? Thanks0 -
Hi @gizmo80 That should work: $ cat /home/myuser/.bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= # User specific aliases and functions alias php=/opt/cpanel/ea-php55/root/usr/bin/php
To test it:# su myuser [myuser@server ~]$ php -v PHP 5.5.38 (cli) (built: Aug 28 2018 14:47:03) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
How did you test that this was/wasn't working?0 -
Thanks Lauren that worked 0 -
Hi @gizmo80 I'm glad to hear it! Thanks for updating as well. 0 -
Hi, so I've not had a lot of experience setting up Laravel in a cPanel environment and I have a problem getting the PHP version correct (7.2) when I enter php -v in the terminal. Here's the setup: CENTOS 6.10 kvm PHP 7.0 is default system PHP version for all accounts that inherit. I've setup a new cPanel account for the install and followed this tutorial for changing the document root (which worked fine): rosehosting.com/blog/how-to-install-laravel-on-a-cpanel-server/ So now, my public directory is /public_html/public instead of /public_html so I can install Laravel inside the /public_html folder and have the /public_html/public folder the portion exposed to the web. After that, I set my account's domain to be PHP 7.2. When I SSH in and test everything, when I'm inside /public_html/public, the PHP version shows up correctly. When I go up a level to the /public_html directory and test, it shows the system version of 7.0. I've tried editing .bashrc and .bash_profile and attempted to locate a tutorial to help, but none of them that I could find would work and I actually ended up breaking something and having to re-create the cPanel account. Any advice would be helpful. 0 -
Hello @DavyWDAC, I moved your post into this thread as it looks to relate to the issue you are facing. Can you confirm if the previous posts here are helpful? Thank you. 0
Please sign in to leave a comment.
Comments
7 comments