can't change php language level macOS , php71 in /opt/local/bin not /usr/bin
Answered
In preferences -> Languages & Frameworks -> PHP I can't change the language level to 7.1 although I've successfully set the CLI interpreter to my installation of php 7.1 in /opt/local/bin
Please sign in to leave a comment.
I should add , it is stuck on language level 5.6 , my system version of php in /usr/bin/php is version 5.6 , and I installed 7.1 in /opt/local/bin/php
Instead of creating project using existing files, I created a new project, this solved the problem.
Hi there,
It must be your composer.json and the PHP version that is set there (IDE by default syncs that value from there).
But you still should be able to change it manually ... unless it has been reworked in 2018.1 (since you have not stated what IDE version you use).
https://youtrack.jetbrains.com/issue/WI-39199#comment=27-2702732
I had the same issue, but changing the requirement in my composer.json from "php" : ">= 7.0" to ">=7.1" automatically switched to php 7.1
I have the same issue on Windows. Since 2018 version, My PHP language level setting is greyed out and I can't change it... Will try to change the composer version.
After changing the composer.json php pre-requisite, it loads the php version I want, but still not able to select it manually in the settings...
Definitely having this issue with a composer.json of Drupal 8 that does not have a minimum PHP spec in there. Maybe it's not good to lock this setting to any composer.json file because what does composer really know about your environment anyway?
>Maybe it's not good to lock this setting to any composer.json file because what does composer really know about your environment anyway?
It knows about your requirements .. and minimal PHP version is one of such requirements.
Just disable such sync with composer.json and you will be controlling appropriate options manually in IDE settings.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000794610/comments/115000659650
I did not have php version specified in composer.json, but setting was stuck at 5.6 nevertheless. Unchecking _Language & Frameworks -> PHP -> Composer -> Synchronize IDE Settings with composer.json_ helped.
My composer file specifies "php": ">=7.2.4", however my IDE settings show PHP Language Level: 5.3 and this can't be edited.
There seems to be a bug is reading the correct version from composer.json.
@Mark Olive
Everything is possible.
In any case:
I could fix this issue.
I only right-clicked in myproject view under External Libraries on PHP Runtime and then click on configure php Runtime where i could change the language level.
@Andriy Bazanov
I found the problem. I had two projects open in my IDE one legacy PHP 5.3 project and one newer PHP 7.2 project. Both had composer.json files, the IDE uses the composer file from the first project to set the IDE version for both projects.
I closed the old project and just have one open at a time, this has fixed the problem.
"I only right-clicked in myproject view under External Libraries on PHP Runtime and then click on configure php Runtime where i could change the language level."
^ This fixed the issue for me
"I only right-clicked in myproject view under External Libraries on PHP Runtime and then click on configure php Runtime where i could change the language level."
^ This fixed the issue for me too
If composer.json is the reason why this is locked, then the UI of a disabled select list is at issue. Having to google this issue and come to this thread isn't time well spent.
If the select is disabled, tell me why: "Locked by composer.json"
Please and thank you.
@Daniel Jackson if you have PHP version specified in your composer.json file, PhpStorm will follow it and synchronize the IDE language level with it. If you need to change the language level, fix composer.json or disable "Synchronize IDE settings with composer.json" option in Settings | Languages & Frameworks | PHP | Composer.
Lol...
Life/PHPStorm hack... So, what I did?.. :)
1) Remove path to composer.json (Settings > Languages... > PHP > Composer),
2) change your PHP version (Settings > Languages... > PHP),
3) get back to composer.json path field and recover the path (press Redo like CTRL+Z),
4) Save. ;)
PhpStorm 2018.2 on Windows 10.
IMO if I specify ">=7.0" in composer.json, that's "greater than or equal to PHP 7.0." The IDE should allow PHP 7.0, 7.1, or 7.2 to be set, particularly if I point it to an executable and it loads the path fine and says 7.2.
>IMO if I specify ">=7.0" in composer.json, that's "greater than or equal to PHP 7.0." The IDE should allow PHP 7.0, 7.1, or 7.2 to be set
Think about it this way: if you choose 7.1 level (for example) and write your code with 7.1+ features (IDE won't complain) .. then if later it will be run on 7.0.x (as per your composer.json -- 7.0 is perfectly valid) it will fail in such place (where 7.1+ features are used).
Other than that: feel free to use Issue Tracker
For all who still have this Problem...
Basically you can switch the php version by updating your composer. It will allways pick the lowest version. So if you have some like this in your composer.json
it will pick php 5.6.
If you prefer to set your language manuelly, you can go to
and unselect Synchronize IDE Settings with composer.json
Now you can set it manually for your project. (For current project only)
Hope this will help some people sticking with this issue :D
"I only right-clicked in myproject view under External Libraries on PHP Runtime and then click on configure php Runtime where i could change the language level."
^ more than two years passed and this is still a golden answer. I am using PHP Storm 2019.2
Go to "File -> Settings -> Languages and Frameworks -> PHP -> Composer" then untick Synchronize IDE Settings with composer.json