-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Self-Check Steps
- I have updated Symfony CLI to the latest version
- I have cleared the PHP versions cache
- I have located my PHP installation(s) and know the full path(s) to the PHP binary(ies)
- I have checked/configured the
SYMFONY_CLI_PHP_PATHenvironment variable if needed
What PHP installation is not being detected?
Hi 👋🏻
I'm having issues when trying to use custom PHP built from sources with the Symfony CLI.
My PHP binaries are located in the following folders:
➜ ~ tree ~/.local/php*/bin
/home/kocal/.local/php-8.1/bin
├── pear
├── peardev
├── pecl
├── phar -> phar.phar
├── phar.phar
├── php
├── php-config
├── phpdbg
└── phpize
/home/kocal/.local/php-8.2/bin
├── phar -> phar.phar
├── phar.phar
├── php
├── php-config
├── phpdbg
└── phpize
/home/kocal/.local/php-8.3/bin
├── phar -> phar.phar
├── phar.phar
├── php
├── php-config
├── phpdbg
└── phpize
/home/kocal/.local/php-8.4/bin
├── phar -> phar.phar
├── phar.phar
├── php
├── php-config
├── phpdbg
└── phpize
/home/kocal/.local/php-8.5/bin
├── phar -> phar.phar
├── phar.phar
├── php
├── php-config
├── phpdbg
└── phpizeWith the following example, I can execute PHP 8.1:
➜ ~ $HOME/.local/php-8.1/bin/php -v
PHP 8.1.34 (cli) (built: Jan 5 2026 15:02:57) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.1.34, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick RethansBut it's impossible with the Symfony CLI, it always use my default PHP version (8.4):
rm ~/.symfony5/php_versions.json
SYMFONY_CLI_PHP_PATH=$HOME/.local/php-8.1/bin symfony php -v
rm ~/.symfony5/php_versions.json
SYMFONY_CLI_PHP_PATH=$HOME/.local/php-8.1/bin/php symfony php -v
rm ~/.symfony5/php_versions.json
export SYMFONY_CLI_PHP_PATH=$HOME/.local/php-8.1/bin; symfony php -v
rm ~/.symfony5/php_versions.json
export SYMFONY_CLI_PHP_PATH=$HOME/.local/php-8.1/bin/php; symfony php -vouput:
PHP 8.4.18-dev (cli) (built: Jan 5 2026 15:46:31) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.18-dev, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
PHP 8.4.18-dev (cli) (built: Jan 5 2026 15:46:31) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.18-dev, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
PHP 8.4.18-dev (cli) (built: Jan 5 2026 15:46:31) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.18-dev, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
PHP 8.4.18-dev (cli) (built: Jan 5 2026 15:46:31) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.18-dev, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
Commands local:php:refresh and local:php:list are not able to detect my PHP versions either.
What command are you running when the issue occurs?
symfony php -v
Operating System
Ubuntu 24.04.1
Symfony CLI Version
Symfony CLI version 5.16.1
PHP Installation(s) - Path and Version
Installation 1
php-config path: /home/kocal/.local/php-8.1/bin/php-config
php-config --version: 8.1.34
php-config --php-binary: /home/kocal/.local/php-8.1/bin/php
php-config --php-sapis: cli fpm phpdbg
Installation 2
php-config path: /home/kocal/.local/php-8.2/bin/php-config
php-config --version: 8.2.31-dev
php-config --php-binary: /home/kocal/.local/php-8.2/bin/php
php-config --php-sapis: cli fpm phpdbg
Installation 3
php-config path: /home/kocal/.local/php-8.3/bin/php-config
php-config --version: 8.3.31-dev
php-config --php-binary: /home/kocal/.local/php-8.3/bin/php
php-config --php-sapis: cli fpm phpdbg
Installation 4
php-config path: /home/kocal/.local/php-8.4/bin/php-config
php-config --version: 8.4.18-dev
php-config --php-binary: /home/kocal/.local/php-8.4/bin/php
php-config --php-sapis: cli fpm phpdbg
Installation 4
php-config path: /home/kocal/.local/php-8.5/bin/php-config
php-config --version: 8.5.3-dev
php-config --php-binary: /home/kocal/.local/php-8.5/bin/php
php-config --php-sapis: cli fpm phpdbg
Output of symfony local:php:list -vvv
➜ dotfiles git:(main) ✗ symfony local:php:list -vvv
6:03PM DBG Looking for PHP in /usr (<nil>) -- *nix
6:03PM DBG Looking for PHP in /usr/local (<nil>) -- *nix
6:03PM DBG Looking for PHP in /opt/lampp (<nil>) -- XAMPP
6:03PM DBG Looking for PHP in /usr/bin (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/bin (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/games (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/games (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/games/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/include (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/include (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/include/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/lib (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/lib (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/lib/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/lib64 (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/lib64 (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/lib64/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/libexec (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/libexec (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/libexec/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/local (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/local (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/locale (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/locale (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/locale/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/sbin (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/sbin (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/sbin/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/share (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/share (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/share/bin as it does not exist
6:03PM DBG Looking for PHP in /usr/src (<nil>) -- Ondrej PPA
6:03PM DBG Looking for PHP in /usr/src (^php(?:[\d\.]+)$) -- Ondrej PPA
6:03PM DBG Skipping /usr/src/bin as it does not exist
6:03PM DBG Looking for PHP in /home/kocal/.config/herd-lite/bin (<nil>) -- php.new (Herd-lite)
6:03PM DBG Skipping /sbin (alias of /usr/sbin), already in the PATH
6:03PM DBG Skipping /bin (alias of /usr/bin), already in the PATH
6:03PM DBG Skipping /snap/bin, already in the PATH
6:03PM DBG Looking for PHP in the PATH ([/home/kocal/.local/php-8.4/sbin /home/kocal/.local/php-8.4/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /usr/games /usr/local/games /snap/bin /home/kocal/.local/share/JetBrains/Toolbox/scripts /home/kocal/.local/bin])
6:03PM DBG Looking for PHP in /home/kocal/.local/php-8.4/sbin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /home/kocal/.local/php-8.4/bin (<nil>) -- PATH
6:03PM DBG Found PHP: /home/kocal/.local/php-8.4/bin/php, with FPM: /home/kocal/.local/php-8.4/sbin/php-fpm, with php-config: /home/kocal/.local/php-8.4/bin/php-config, with phpize: /home/kocal/.local/php-8.4/bin/phpize, with phpdbg: /home/kocal/.local/php-8.4/bin/phpdbg
6:03PM DBG System PHP version (first in PATH)
6:03PM DBG Looking for PHP in /usr/local/sbin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /usr/local/bin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /usr/sbin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /usr/bin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /usr/games (<nil>) -- PATH
6:03PM DBG Looking for PHP in /usr/local/games (<nil>) -- PATH
6:03PM DBG Looking for PHP in /snap/bin (<nil>) -- PATH
6:03PM DBG Looking for PHP in /home/kocal/.local/share/JetBrains/Toolbox/scripts (<nil>) -- PATH
6:03PM DBG Looking for PHP in /home/kocal/.local/bin (<nil>) -- PATH
+---------+----------------------------+---------+--------------+---------+---------+---------+
| Version | Directory | PHP | PHP | PHP | Server | System? |
| | | CLI | FPM | CGI | | |
+---------+----------------------------+---------+--------------+---------+---------+---------+
| 8.4.18 | /home/kocal/.local/php-8.4 | bin/php | sbin/php-fpm | | PHP FPM | * |
+---------+----------------------------+---------+--------------+---------+---------+---------+
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. 8.5 or 8.5.0),
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.Additional Diagnostic Information
echo $PATH
echo $SYMFONY_CLI_PHP_PATH
/home/kocal/.local/php-8.4/sbin:/home/kocal/.local/php-8.4/bin:/home/kocal/.cargo/bin:/home/kocal/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/kocal/.local/share/JetBrains/Toolbox/scripts:/home/kocal/.local/bin
<empty>
(I didn't execute `php` and `which php`, it works fine, and that's not the issue)Are there any error messages?
No response
Did this work before?
No response
Any other relevant information
Thanks!
Information Checklist
- I have updated Symfony CLI to the latest version
- I have cleared the PHP versions cache
- I have provided the output of
symfony local:php:list -vvv - I have provided system information (OS, Symfony CLI version)
- I have provided PHP installation path(s) and version(s) (preferably using php-config)