Setting CLI PHP version 5.6...

5 posts / 0 new
Last post
#1 Sat, 09/17/2016 - 11:26
meredevelopment

Setting CLI PHP version 5.6...

Hi, I think this might be a CentOS question rather than a Virtualmin one, but I'll start here. I've used SCL to add 'rh-php56' to my CentOS 6.8 / Virtualmin 1.8.10 server. PHP 5.6.5 is being detected by Virtualmin, I can configure it, assign it to sites etc. Everythings lovely! However...

I'm using Laravel, and a lot of installation / admin is done over CLI. On this server if I 'php -v' I get 5.3.3 - the current CentOS default I believe. Laravel needs 5.6+. Using 'scl enable rh-php56 bash' I can switch to 5.6 temporarily, but my question is, what would be the best way to permanently switch to 5.6 in the CLI?

Thanks!

Sun, 09/18/2016 - 17:23
buggly-B

Hey there,

I'm using CentOS, Virtualmin (Webmin) and follwoing PHP versions: 5.4 (CentOS) 5.6 and 7.0 (both from remi). There is no need for SCL for using multiple PHP versions. :-)

While you don't replace the CentOS delivered one php. I'm not quite familiar to Laravel.... can't you use a php.ini?

P.S.: Better use MaraiDB from offical repo than MySQL/MariaDB provided by RedHat / Oracle.

Mon, 09/19/2016 - 03:11 (Reply to #2)
meredevelopment

Hi, thanks, I will investigate how to remove the SCL version of 5.6, and reinstall it from remi. I've looked at the wizard here: http://rpms.remirepo.net/wizard/ and it says half way down "You want multiple versions which means using a Software Collection".

But my main issue / question is using PHP 5.6 on the command line. Laravel has a php helper app called Artisan that handles a multitude of things like DB creation, seeding, authentication setup, route management, and it needs PHP 5.6 to run. I need to be able to run these commands outside the public_html directory, so I'm not sure how I would use a php.ini to help?

Cheers! Ben

Fri, 09/30/2016 - 12:47 (Reply to #3)
cruiskeen

Basically you just need to change your $PATH variable to include the right PHP version early in your path --- which is basically all that scl enable does. Don't know enough about your environment to suggest specifics but you probably want to edit the .bash_profile or whatever is setting your $PATH for whatever user you are logged in as when doing this. You can just run the appropriate scl enable there or just change the path by hand

Mon, 01/22/2018 - 16:14
aalred

Old, I know, but wanted to add that you could try 'scl enable rh-php56 bash'. That should modify your path on your CLI environment. Otherwise, yeah, you could just modify your bash profile manually.

Topic locked