Different PHP versions for multiple projects

Ok, bear with me... I've been using PHPStorm happily for a while on a single custom project (PHP framework contained in single project folder connecting to a live hosted DB defined by a local config file). This is all nicely integrated with Github and works a treat, however, it's using PHP v5.6 (the framework doesnt support higher).

I want to develop a new site based on Laravel and have installed Xampp, popped the Laravel framework into the htdoc folder, and set up Apache and the Mysql DB. I've configured the project settings to use PHP7.1 (native in Xampp).This is all fine and I can navigate to localhost and I see the Apache front page and localhost:port and I get the PHP framework homepage, but as soon as I try and install, I get encryption errors. I know I need to install composer but as soon as I try from terminal, it tells me the package requires PHP >=7.0 and I'm running 5.6! So although the project settings are correct at 7.0, my system has 5.6 as native and I can't seem to get past that. I don't want to change to 7.0 and remove 5.6 because I still need to work on the older site while I develop the new but I don't know how to get this working so the new project sees 7.0 when I install composer and run dependency upgrades.

Does that make sense?

I did try and set a PATH variable to the PHP7 folder as well as the current 5.6 but that appeared to break the old site so I'm nervous about changing anything I'm not sure about...

1 comment

> I know I need to install composer but as soon as I try from terminal

Please note that PhpStorm settings have no effect over the Terminal - it's still Terminal, just bundled in a PhpStorm window.
If you need run `composer install` with the interpreter defined in PhpStorm settings, just run Tools | Composer | Init Composer && Install.

1

Please sign in to leave a comment.