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?
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.
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?
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
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.