CakePHP3 - 要求自动加载无法打开流,没有这样的文件或目录
CakePHP3 - require autoload failed to open stream, no such file or directory
将我的 CakePHP3 项目部署到 Ubuntu 14.04 服务器后,当我在浏览器中打开项目时出现此错误:
Warning: require(/var/www/html/xyz-web/vendor/autoload.php): failed to
open stream: No such file or directory in
/var/www/html/xyz-web/config/bootstrap.php on line 38
Fatal error: require(): Failed opening required
'/var/www/html/xyz-web/vendor/autoload.php'
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/html/xyz-web/config/bootstrap.php on line 38
如果我 运行 bin/cake server
在该目录中(在服务器上),我会得到下一个输出:
Warning: require(/var/www/html/xyz-web/vendor/autoload.php): failed to
open stream: No such file or directory in
/var/www/html/xyz-web/config/bootstrap.php on line 38 PHP Fatal error:
require(): Failed opening required
'/var/www/html/xyz-web/vendor/autoload.php'
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/html/xyz-web/config/bootstrap.php on line 38
Fatal error: require(): Failed opening required
'/var/www/html/xyz-web/vendor/autoload.php'
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/html/xyz-web/config/bootstrap.php on line 38
我该如何解决?
我通过在服务器上安装 composer 并将其运行放入项目中解决了这个问题。
sudo apt-get update && sudo apt-get install curl php5-cli git && curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
然后 cd
到蛋糕项目 (cd /var/www/html/{project_name}
) 和 运行 composer install
安装所需的包。
将我的 CakePHP3 项目部署到 Ubuntu 14.04 服务器后,当我在浏览器中打开项目时出现此错误:
Warning: require(/var/www/html/xyz-web/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/xyz-web/config/bootstrap.php on line 38
Fatal error: require(): Failed opening required '/var/www/html/xyz-web/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/xyz-web/config/bootstrap.php on line 38
如果我 运行 bin/cake server
在该目录中(在服务器上),我会得到下一个输出:
Warning: require(/var/www/html/xyz-web/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/xyz-web/config/bootstrap.php on line 38 PHP Fatal error: require(): Failed opening required '/var/www/html/xyz-web/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/xyz-web/config/bootstrap.php on line 38
Fatal error: require(): Failed opening required '/var/www/html/xyz-web/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/xyz-web/config/bootstrap.php on line 38
我该如何解决?
我通过在服务器上安装 composer 并将其运行放入项目中解决了这个问题。
sudo apt-get update && sudo apt-get install curl php5-cli git && curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
然后 cd
到蛋糕项目 (cd /var/www/html/{project_name}
) 和 运行 composer install
安装所需的包。