Michael Emerson
Michael Emerson

Reputation: 1813

PHP versions conflicting

I'm working on a Symfony 2.8.9 site, but it requires PHP 5.5 or higher. In Plesk 12.5 I have set the server to use 5.6 which is fine, but when I run the composer install command via ssh, I get the following message:

  • symfony/symfony v2.7.0 requires php >=5.3.9 -> your PHP version (5.3.3) does not satisfy that requirement.

So I typed php -v and receieve the following message:

PHP 5.3.3 (cli) (built: Aug 11 2016 20:33:53)

I'm not sure why it says 5.3.3 on command line even though it's set to 5.6 in Plesk, how can I get around this? I'm unable to run my composer updates and even attempting to clear the cache throws errors which I am certain pertains to the outdated version of PHP.

Upvotes: 1

Views: 1037

Answers (2)

Rufinus
Rufinus

Reputation: 30753

As you have a plesk server you have to use the correct php-cli binary yourself.

The installed php versions are located at /opt/plesk/php in your case: /opt/plesk/php/5.6/bin/php

If you are root of this server you can help yourself with a simple symlink: ln -s /opt/plesk/php/5.6/bin/php /usr/local/bin/php-5.6

then you can use php-5.6 composer.phar

if not, you have to use the full path, or add an alias to your .bashrc.

an alternative is to add the --ignore-platform-reqs to the composer call. in most cases it will work (the php requirement is just ignored) - if the composer skript itself uses some 5.6 specific syntax, this will not work of course.

EDIT: my plesk is running on Ubuntu 16.04 - so the system php is 5.5.9 already - which makes the --ignore-platform-reqs trick very usable. on 5.3.3 i think you will run in more trouble.

Upvotes: 2

Ben Hillier
Ben Hillier

Reputation: 2104

Are there more versions of php on your server? It could be that the webserver uses one version, and the CLI uses another.

Try the command which php to see what gets called.

Upvotes: 1

Related Questions