I'm building an EC2 LAMP server for the first time, and so far so good.

Except I can't seem to get the

require 'vendor/autoload.php'; working right

I get this error message whenever I write that line above

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

I know I have those files. My path to the file is:


The files that represent my web page are in


I can verify both using Filezilla.

Do I need to configure permissions, or move the whole vendor folder to a place where it can be accessed? Did I make an error with the path?

Thanks in advance.

ps aux | grep apache gives me this: I think this means that its running under ec2-user?

How do I switch it, then?

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 has only rwx------ permissions, thous webserver ( running as apache), doesn't have read rights.
Do a

chmod 755 /home/ec2-user
  • will this be okay for security? – House- 'Reinstate Monica' -man May 15 '13 at 17:55
  • Yes, that changes only /home/ec2-user and not the files in it. Or you can move the 'vendor' folder to somewhere else (/var/www/html/vendor, /srv/www/vendor), plenty choices, in some case may require additional apache config. – Sandor Marton May 15 '13 at 17:58
  • well, that worked, but now I have an unrelated error. Thanks. – House- 'Reinstate Monica' -man May 15 '13 at 18:01

I guess wrong owner of the files. Apache would be running as apache,apache2,httpd or www-data user (those are the usual ones). If you created those files as somebody else, the webserver probably cannot read them.

  • Oh, I see. That makes sense. Do you suggest, then, that I login as apache, or something, then install composer? – House- 'Reinstate Monica' -man May 15 '13 at 17:07
  • If it is not a security risk, you could just add the read privilege for the apache user (or for all), but generally i don't recommend that. If you can, issue the chown command (either as a root or the owner of files) and change the ownership of files to the apache user. – Fiisch May 15 '13 at 17:09
  • I input chown -R apache home/ec2-user/vendor, but it says no such file or directory, despite me confirming the path with filezilla. – House- 'Reinstate Monica' -man May 15 '13 at 17:20
  • you have written the relative path, you probably meant chown -R apache /home/ec2-user/vendor also, have you confirmed the apache really runs under apache user? – Fiisch May 15 '13 at 17:32
  • I did the command successfully. No change. No, I have not confirmed that the apache really runs under apache user. How do I check that, or switch it? – House- 'Reinstate Monica' -man May 15 '13 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.