Search code examples
symfonyvendor

Move symfony vendor outside the root project


I want to speed up my symfony2 project on my vagrant box, so I want to move my vendors outside the project folder.

I have install them in /home/vagrant/www/simtp/vendor, but I got a permission error when the autoload.php is included.

Warning: require(/home/vagrant/www/simtp/vendor/autoload.php): failed to open stream: Permission denied in /var/www/simtp/app/autoload.php on line 11

Fatal error: require(): Failed opening required '/home/vagrant/www/simtp/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/simtp/app/autoload.php on line 11

I have already tested to change permission with chown, before it was "root", and now it is "www-data" (like the old vendor folder). I have already too tested to change chmod for 777.

But nothing work ... :/ Ps : My cache folder is empty.

What can I do?

Thanks.


Solution

  • I am no expert in this, but since no one else replied, I think easiest solution would be moving vendor files to directory that is not in other user's home directory. in this case: /home/vagrant/

    to let's say: /var/www-vendor/simtp/app/

    this vendor directory should have chown compatible with apache worker (so it would have access)

    you can also try solutions described here: https://unix.stackexchange.com/questions/91488/allow-a-user-to-read-some-other-users-home-directories

    as far as I know despite standard permissions, user home directories are especially protected, that is the reason you have this issue.

    you also didnt stated what linux distro you are using so you could consider adding this to your question so others would have less work to do.