change php version of phpstorm terminal
changing php version in local web server doesn’t change the version in the command line terminal of an IDE like PhpStorm.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-4.png)
here I changed the php version in laragon but the version in phpstorm terminal stays the same.
you can check it with php -v
command
![](https://phpjunior.com/wp-content/uploads/2023/06/image-3-1024x307.png)
to change that we go to File-> Settings -> PHP .
![](https://phpjunior.com/wp-content/uploads/2023/06/image-6-1024x741.png)
you can see that “PHP language level” and “CLI interpreter” are at 8.1.
we have to change the CLI Interpreter. for doing that, click on the button with three dots(…)
then at the new window click on the “+” sign at top left corner. then click on “Other Local”.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-7-1024x814.png)
here you can choose the php version you want for the cli.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-8.png)
after that you will have another php version listed in “CLI Interpreters” window.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-9-1024x847.png)
you can select that as the php version for cli.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-10-1024x289.png)
change terminal environment variables
The final step is to change the “PATH” environment variable for terminal in phpstorm.
to do that go to File -> Settings -> Tools -> Terminal
at the right side you see Environment variables input. click on the button next to it.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-11-1024x741.png)
at the bottom look for the Path variable.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-12.png)
double click on the value and copy it to a text editor like Notepad.
search for the word “php” and you will find the path to the PHP version.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-13-1024x60.png)
change it to the path that you want and exists in php folder.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-14.png)
![](https://phpjunior.com/wp-content/uploads/2023/06/image-16-1024x85.png)
now copy this and paste it in the Path value in phpstorm environment variables. then click ok
use php -v and check the version now. it will be the correct version you chose.
![](https://phpjunior.com/wp-content/uploads/2023/06/image-17.png)