简体   繁体   中英

What directories and permission does php composer require for `composer install`?

I'm trying to run composer install with the specific user. However I run into permission errors:

$ composer install
Cannot create cache directory /var/www/.cache/composer/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.cache/composer/files/, or directory is not writable. Proceeding without cache
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 118 installs, 0 updates, 0 removals

                                                                 
  [RuntimeException]                                             
  /var/www/html/vendor does not exist and could not be created.

So /var/www/.cache - is this meant to be ~/.cache ? Is there a definitive list what directories and permissions are required?

Composer version:

Composer version 2.0.8 2020-12-03 17:20:38

In my particular case above I needed:

/var/www/html/vendor
/var/www/html/public
/var/www/html/var/log/
/var/www/html/var/cache/

The above directories owned as www-data:www-data with 766 permission. Though potentially 700 permissions would be more secure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM