I'm trying to move my Project to a linux redhat server that uses Apache but the problem I'm facing there is that this Server has 2 different PHP versions installed.
Symfony (2.5.12) seems to look for the php executable at /usr/bin/php
by default but there is a 5.2 version installed, which is needed for other projects.
At /opt/rh/php55/root/usr/bin/php
is an installed 5.5 version of PHP that I want to use for symfony.
So how can I configure Symfony to use the php version that is installed at the custom path?
I know this is old, but I had the same issue of Symfony using an older PHP version (7.1 in my case, the default with OSX Mojave) than I had installed. My $PATH
variable pointed to the newer 7.2 version and php -v
showed 7.2 and still Symfony used 7.1.
It looks like this was solved when I ran:
symfony local:php:list
It listed all the PHP versions on my system and it had 7.2 marked as default. After running this and executing symfony server:start
it was on 7.2.
The php:list
command also give useful instructions on setting a specific PHP version for a project:
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 SymfonyCloud, the version can also be specified in the.symfony.cloud.yaml
file.