0

I created a Symfony 6 project locally on my PC (Windows 11 Entreprise v.21H2) and I want to use a specific version of PHP. I know that we can use different versions by creating a .php-version file in the project root.

So I did this command symfony local:php:list and it only shows Wamp64 and Xampp php that I don't want to use. I have many other versions inside C:/php/ folder. For this project, I need to use php 8.0.19.

My question is : how can I select php 8.0.19 if even Symfony CLI doesn't show it in the list ? And why ?

enter image description here

enter image description here

Eve
  • 776
  • 2
  • 11
  • 32
  • Have you tried refreshing the list? There is a command for it, similar to list, I think it’s called `local:php:refresh`. If that doesn’t help, you should probably check if the binary is registered in PATH in your local environment variable. – dbrumann Sep 10 '22 at 06:35
  • Yes I did the refresh and nothing changed. What do you mean by the "binary" ? – Eve Sep 12 '22 at 06:38
  • Sorry, that was a bit unclear. If you want to use php.exe in any of the directories in your screenshot from anywhere else, you have to add the directory, e.g. “C:\php\8.0.19\” to the PATH variable (or call the full path).Maybe the Symfony CLI will better find the other version by adding it to the PATH – dbrumann Sep 13 '22 at 02:04
  • I did it too, it was my first reaction when I saw the issue. The console uses the good version of php when I check by doing `php -v` but Symfony still doesn't find it... – Eve Sep 13 '22 at 14:11
  • It looks like someone else reported the same issue: https://github.com/symfony-cli/symfony-cli/issues/78 I don’t have a PC for the next week, so I can’t look at the code in more detail, but I would guess the location Fabien linked either needs fixing or you need to check how it finds the PHP versions and make some changes – dbrumann Sep 14 '22 at 07:53
  • Here is how it works : https://github.com/symfony-cli/phpstore/blob/main/discovery_windows.go and I opened a ticket on the github : https://github.com/symfony-cli/symfony-cli/issues/182 . In the meantime, I work with wampserver... – Eve Sep 15 '22 at 08:34

0 Answers0