skip to Main Content

My client uses a server with Apache PHP version 5.6.30 but the CLI PHP version is 5.4.16. And they can’t change the CLI PHP version.

I use Git && SSH to push the project to the server from my local machine. But since the CLI PHP version is 5.4.16, I can’t run

composer install

I will get these messages

Problem 1
    - This package requires php >=5.6.4 but your PHP version (5.4.16) does not satisfy that requirement.
  Problem 2
    - symfony/var-dumper v3.3.2 requires php >=5.5.9 -> your PHP version (5.4.16) does not satisfy that requirement.
    - symfony/var-dumper v3.3.2 requires php >=5.5.9 -> your PHP version (5.4.16) does not satisfy that requirement.
    - Installation request for symfony/var-dumper v3.3.2 -> satisfiable by symfony/var-dumper[v3.3.2].

The phpinfo() tells that the version of PHP is 5.6.30. So I guess that part should be fine. But I don’t know that to solve this situation.

When I go to the website, I get these error messages:

Warning: require(/var/www/vhosts/example.com/httpdocs/vendor/composer/ClassLoader.php): failed to open stream: No such file or directory in /var/www/vhosts/example.com/httpdocs/vendor/composer/autoload_real.php on line 12

Warning: require(/var/www/vhosts/example.com/httpdocs/vendor/composer/ClassLoader.php): failed to open stream: No such file or directory in /var/www/vhosts/example.com/httpdocs/vendor/composer/autoload_real.php on line 12

Fatal error: require(): Failed opening required '/var/www/vhosts/example.com/httpdocs/vendor/composer/ClassLoader.php' (include_path='.:/opt/plesk/php/5.6/share/pear') in /var/www/vhosts/example.com/httpdocs/vendor/composer/autoload_real.php on line 12

2

Answers


  1. Although not ideal, you can also push the entire vendor folder along to the server. All composer install really does is create the vendor folder. If you upload your entire project folder, vendors included, then you will be able to run it on the server without running composer. As long as the web version meets your minimum requirements, then this means that you should be able to effectively ignore the client version.

    That being said, you’ll run into this problem again if you need to run any tasks from the command line.

    Login or Signup to reply.
  2. Since you’re using plesk, you should find the binary of other PHP versions at /opt/plesk/php.

    /opt/plesk/php/5.6/bin/php /usr/bin/composer install
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search