require()调用另一个PHP文件时权限被拒绝



我使用Apache服务器文档根目录中的PHP文件(index.PHP(中的require((。PHP文件执行失败。apache的error_log中抛出的错误低于

PHP致命错误:require((:打开失败'/root/new/test/public//vendor/autoload.php’(include_path='.:/usr/share/pear:/usr/share/php'(/第24行的root/new/test/public/index.php

第24行有

需要DIR.//vendor/autoload.php’;

我已授予777对供应商目录的权限,甚至对/root/new/test文件夹的权限。但问题仍然存在。

httpd.conf中的apache设置如下

<VirtualHost *:80>
DocumentRoot /root/new/test/public
<Directory "/root/new/test/public">
Options +Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
Require local
</Directory>
</VirtualHost>

我在这里错过了什么?

更新1:

我已经运行了composer install,它给出了以下输出

[root@localhost test]# composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files IlluminateFoundationComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.

我认为您没有安装composer

composer install

在Install Composer授予权限后,将公用文件夹&存储

您可以从composer.json:自动加载文件

"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
},
"files": [
"app/Helpers/global.php",
]
},

在这里,我的应用程序将加载/app/Helpers/global.php,它将在全球范围内可用。它可能需要composer dumpautoload

最新更新