Laravel 9安装报错

Laravel9 在centOS 7服务器中,通过composer安装后报错。
PHP版本:

PHP 8.0.28 (cli) (built: Jun 28 2023 14:20:44) ( NTS )
Copyright © The PHP Group
Zend Engine v4.0.28, Copyright © Zend Technologies

输入完命令

composer create-project laravel/laravel=9.* 项目名

配置完nginx配置之后,访问首页,报错了。报错内容如下

Warning: file_exists(): open_basedir restriction in effect. File(/www/wwwroot/default/aaaa/public/../storage/framework/maintenance.php) is not within the allowed path(s): (/www/wwwroot/default/aaaa/public/:/tmp/:/proc/) in /www/wwwroot/default/aaaa/public/index.php on line 19

Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/default/aaaa/vendor/autoload.php) is not within the allowed path(s): (/www/wwwroot/default/aaaa/public/:/tmp/:/proc/) in /www/wwwroot/default/aaaa/public/index.php on line 34

Warning: require(/www/wwwroot/default/aaaa/vendor/autoload.php): Failed to open stream: Operation not permitted in /www/wwwroot/default/aaaa/public/index.php on line 34

Fatal error: Uncaught Error: Failed opening required '/www/wwwroot/default/aaaa/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /www/wwwroot/default/aaaa/public/index.php:34 Stack trace: #0 {main} thrown in /www/wwwroot/default/aaaa/public/index.php on line 34

解决方案

1.查看php.ini中的open_basedir是否已经注释,没有注释就加个“;”注释一下
2.vim fastcgi.conf

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/www/wwwroot/default/项目地址不用写到public";

重启nginx生效。

你可能感兴趣的:(laravel,php)