无此文件或目录

我第一次build立一个EC2 LAMP服务器,到目前为止这么好。

除了我似乎无法得到的

require 'vendor/autoload.php'; 正确的工作

每当我在上面写这行时,我都会收到这个错误消息

 Warning: require(/home/ec2-user/vendor/autoload.php): failed to open stream: Permission denied in /var/www/html/tables.php on line 6 Fatal error: require(): Failed opening required '/home/ec2-user/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/tables.php on line 6 

我知道我有这些文件。 我的文件的path是:

/home/ec2-user/vendor/composer/autoload.php

代表我的网页的文件在

/var/www/html/

我可以使用Filezilla进行validation。

我是否需要configuration权限,或将整个供应商文件夹移到可以访问的地方? 我在路上犯了什么错误?

提前致谢。


ps aux | grep apache ps aux | grep apache给我这个:我认为这意味着它在ec2用户下运行?

那我该如何切换呢?

 apache 1511 0.0 1.5 407000 9376 ? S 15:30 0:00 /usr/sbin/httpd apache 1512 0.0 1.3 407376 8380 ? S 15:30 0:00 /usr/sbin/httpd apache 1513 0.0 1.5 406996 9368 ? S 15:30 0:00 /usr/sbin/httpd apache 1514 0.0 1.3 406880 8388 ? S 15:30 0:00 /usr/sbin/httpd apache 1515 0.0 1.5 406880 9368 ? S 15:30 0:00 /usr/sbin/httpd apache 1516 0.0 1.3 406880 8320 ? S 15:30 0:00 /usr/sbin/httpd apache 1517 0.0 1.5 406880 9356 ? S 15:30 0:00 /usr/sbin/httpd apache 1518 0.0 1.3 406880 8380 ? S 15:30 0:00 /usr/sbin/httpd ec2-user 2191 0.0 0.1 103416 828 pts/0 S+ 17:45 0:00 grep apache 

/ home / ec2-user只有rwx ——权限,这个webserver(以apache的身份运行)没有读取权限。
做一个

 chmod 755 /home/ec2-user 

我猜错了文件的所有者。 Apache将以apacheapache2httpdwww-data用户身份运行(这些都是常用的)。 如果您以其他人的身份创build这些文件,则Web服务器可能无法读取它们。