我的客户端使用Apache PHP版本5.6.30的服务器,但CLI PHP版本是5.4.16。并且他们无法更改CLI PHP版本。
我使用Git&& SSH将项目从本地计算机推送到服务器。但由于CLI PHP版本为5.4.16,我无法运行
composer install
我会收到这些消息
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].
phpinfo()告诉PHP的版本是5.6.30。所以我想这部分应该没问题。但我不知道要解决这个问题。
当我访问该网站时,我收到以下错误消息:
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
答案 0 :(得分:3)
由于您正在使用plesk,您应该在/ opt / plesk / php中找到其他PHP版本的二进制文件。
/opt/plesk/php/5.6/bin/php /usr/bin/composer install
答案 1 :(得分:0)
虽然不理想,但您也可以将整个供应商文件夹推送到服务器。所有composer install
确实是创建供应商文件夹。如果您上传整个项目文件夹(包括供应商),那么您将能够在服务器上运行它而无需运行composer。只要Web版本满足您的最低要求,这意味着您应该能够有效地忽略客户端版本。
话虽如此,如果您需要从命令行运行任何任务,您将再次遇到此问题。