浏览文章

文章信息

后端 PHP Failed opening required 'Composer/autoload.php' 16104

报错:

PHP Warning:  require(Composer/autoload.php): failed to open stream: No such file or directory in /usr/bin/composer on line 8

Warning: require(Composer/autoload.php): failed to open stream: No such file or directory in /usr/bin/composer on line 8

PHP Fatal error:  require(): Failed opening required 'Composer/autoload.php' (include_path='.:/www/server/php/72/lib/php') in /usr/bin/composer on line 8

Fatal error: require(): Failed opening required 'Composer/autoload.php' (include_path='.:/www/server/php/72/lib/php') in /usr/bin/composer on line 8


1、原因

php未查找到composer目录,加载不了composer类


2、解决:

将/usr/share/php添加到php.ini中的include_path中

以下是php.ini配置位置的部分配置

...
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path = ".:/var/www/vhosts/default/vendor/magento/zendframework1/library:/www/server/php/73/lib/php:/usr/share/php"
;include_path = "."
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
...


原创