user3440145
user3440145

Reputation: 843

Set PHP version for Symfony project in PhpStorm

In a Symfony 3.4 project which I develop using PhpStorm I use the PhpStorm Terminal Window for running the Symfony server like

php bin/console server:run

This works fine. However the terminal uses the PHP version that is set in the windows environment path variable.

I don't get it to use the PHP version configured in the project setting (Settings -> Languages & Frameworks -> PHP) in the field CLI Interpreter.

Why is the terminal ignoring this setting totally?

Upvotes: 2

Views: 1883

Answers (1)

Álvaro González
Álvaro González

Reputation: 146410

You can configure the terminal for current project and set a custom PATH so php runs whatever interpreter you want. Open the Settings dialogue and head to Tools/ Terminal.

I think the neatest option is to tweak Shell path like this:

"cmd" /k "PATH=C:\php-5.6.0-Win32-VC11-x64;%PATH%"

Shell path

Terminal

You can also do the obvious thing and edit the environment variables to set PATH.

Environment variables

It works just fine but this variable totally overrides the parent PATH and I couldn't find a way to just prepend my value (neither $PATH nor %PATH% work).

Some other ideas:

  • Use "cmd" /k to load a custom configuration script.
  • Set PowerShell as shell and create aliases.

Upvotes: 1

Related Questions