-
-
Notifications
You must be signed in to change notification settings - Fork 12
Detect PHP version from system %PATH% variable #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you for your PR! I was surprised this was not already supported, and after some research, it looks like it should already be supported by the current codebase. did you have a look to see if this works or not? |
Co-authored-by: Tugdual Saunier <[email protected]>
Co-authored-by: Tugdual Saunier <[email protected]>
Co-authored-by: Tugdual Saunier <[email protected]>
I had a very old version of symfony-cli, and it worked, but in version Symfony CLI version: 5.11.0 %PATH%: C:\dev\terminal\ConEmu\ConEmu\Scripts
C:\dev\terminal\ConEmu
C:\dev\terminal\ConEmu\ConEmu
C:\Program Files\TotalCommander2021\
C:\Program Files\Microsoft MPI\Bin\
C:\Program Files\Eclipse Adoptium\jdk-21.0.0.35-hotspot\bin
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\dev\docs
C:\dev\lang\php\8.4.4
C:\dev\commands
C:\dev\regex
C:\dev\utils
C:\dev\utils\gnu
C:\dev\lang\js\node
C:\dev\lang\php\tools
C:\Python\Python312
C:\Python\Python312\Scripts
C:\dev\utils\7zip
C:\dev\utils\gs\bin
C:\dev\utils\ssh
C:\ProgramData\chocolatey\bin
C:\dev\net\winscp\
C:\dev\utils\rsync
C:\UnicaApp\utils\magick
C:\UnicaApp\utils\7z
C:\dev\image\ffmpeg\bin
C:\dev\lang\golang\bin
C:\dev\utils\GnuPG\bin
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
C:\dev\lang\d\dmd2\windows\bin64
C:\Program Files\dotnet\
C:\Program Files\Git\cmd
C:\Program Files\TortoiseGit\bin
C:\dev\utils\ssh\
C:\dev\lang\rust\1.84\bin
C:\Program Files\Docker\Docker\resources\bin
C:\Users\Usr\AppData\Roaming\dvm\compilers\dmd-2.058\bin
C:\Users\Usr\AppData\Roaming\dvm\bin
C:\Users\Usr\AppData\Local\Programs\Python\Launcher\
C:\Users\Usr\AppData\Local\Microsoft\WindowsApps
C:\Users\Usr\AppData\Local\Programs\Microsoft VS Code\bin
C:\dev\ide\PhpStorm 2023.2.2\bin
C:\Users\Usr\go\bin
C:\Users\Usr\.dotnet\tools
C:\dev\lang\js\nvm
C:\dev\lang\js\nodejs
C:\Users\Usr\AppData\Local\GitHubDesktop\bin symfony local:php:list -vvv Output: 9:07AM DBG Looking for PHP in C:\xampp\php (<nil>) -- XAMPP
9:07AM DBG Looking for PHP in C:\cygwin64\bin (<nil>) -- Cygwin
9:07AM DBG Looking for PHP in C:\cygwin\bin (<nil>) -- Cygwin
9:07AM DBG Skipping (alias of .), already in the PATH
9:07AM DBG Looking for PHP in the PATH ([C:\Program Files\TotalCommander2021 C:\Program Files\Microsoft MPI\Bin C:\Program Files\Eclipse Adoptium\jdk-21.0.0.35-hotspot\bin C:\Program Files (x86)\Common Files\Oracle\Java\javapath C:\Windows\System32 C:\Windows C:\Windows\System32\wbem C:\Windows\System32\WindowsPowerShell\v1.0 C:\Windows\System32\OpenSSH C:\Python\Python312 C:\Python\Python312\Scripts C:\ProgramData\chocolatey\bin C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn C:\Program Files\Microsoft SQL Server\150\Tools\Binn C:\Program Files\dotnet C:\Program Files\Git\cmd C:\Program Files\TortoiseGit\bin C:\Program Files\Docker\Docker\resources\bin C:\Users\Usr\AppData\Roaming\dvm\bin C:\Users\Usr\AppData\Local\Programs\Python\Launcher C:\Users\Usr\AppData\Local\Microsoft\WindowsApps C:\Users\Usr\AppData\Local\Programs\Microsoft VS Code\bin . C:\Users\Usr\AppData\Local\GitHubDesktop\bin])
9:07AM DBG Looking for PHP in C:\Program Files\TotalCommander2021 (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Microsoft MPI\Bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Eclipse Adoptium\jdk-21.0.0.35-hotspot\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files (x86)\Common Files\Oracle\Java\javapath (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Windows\System32 (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Windows (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Windows\System32\wbem (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Windows\System32\WindowsPowerShell\v1.0 (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Windows\System32\OpenSSH (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Python\Python312 (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Python\Python312\Scripts (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\ProgramData\chocolatey\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Microsoft SQL Server\150\Tools\Binn (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\dotnet (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Git\cmd (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\TortoiseGit\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Program Files\Docker\Docker\resources\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Users\Usr\AppData\Roaming\dvm\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Users\Usr\AppData\Local\Programs\Python\Launcher (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Users\Usr\AppData\Local\Microsoft\WindowsApps (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Users\Usr\AppData\Local\Programs\Microsoft VS Code\bin (<nil>) -- PATH
9:07AM DBG Looking for PHP in . (<nil>) -- PATH
9:07AM DBG Looking for PHP in C:\Users\Usr\AppData\Local\GitHubDesktop\bin (<nil>) -- PATH
+---------+-----------+---------+---------+---------+--------+---------+
| Version | Directory | PHP | PHP | PHP | Server | System? |
| | | CLI | FPM | CGI | | |
+---------+-----------+---------+---------+---------+--------+---------+
+---------+-----------+---------+---------+---------+--------+---------+
To control the version used in a directory, create a .php-version file that contains the version number (e.g. 8.4 or 8.4.2),
or define config.platform.php inside composer.json.
If you're using Platform.sh or Upsun, the version can also be specified in their configuration files. |
It is strange that neither of the values for Just to be on the safe side: could you try with another version of the CLI from the 5.x branch up to v5.8.14 ? Thanks! |
symfony-old.exe version Output: Symfony CLI version 5.4.19 symfony-old.exe local:php:list Output: +---------+----------------------------+---------+---------+-------------+---------+---------+
| Version | Directory | PHP | PHP | PHP | Server | System? |
| | | CLI | FPM | CGI | | |
+---------+----------------------------+---------+---------+-------------+---------+---------+
| 8.4.4 | D:\Soft\dev\lang\php\8.4.4 | php.exe | | php-cgi.exe | PHP CGI | * |
+---------+----------------------------+---------+---------+-------------+---------+---------+
The current PHP version is selected from default version in $PATH
To control the version used in a directory, create a .php-version file that contains the version number (e.g. 7.2 or 7.2.15).
If you're using Platform.sh, the version can also be specified in the .platform.app.yaml file.
|
I have discovered the problem, it is in the function edir, err := filepath.EvalSymlinks(dir) the err varible contain this text: "The system cannot find the path specified." The problem is that I use Directory Junction for EvalSymlinks has open issues on Windows: golang/go#40180 |
Fix Symfony CLI not detecting php.exe in the system environment on Windows