The project is put on github and a webhook is made. The server detects the post from github. If the master node changes, run {code...} to pull the code. At last, the compoer in the master Branch is also detected. when json is modified, run the following command: {code ...... the project is put on github and a webhook is made. The server detects the post from github. If the master node changes, execute
cd /path;git pull git@ooxxx.com
There is no problem with pulling the code above.
At the same time, if the compoer. json in the master branch is modified, run the following command:
php composer.phar updatephp composer.phar dump-autoload -o
Because the post data from github is executed by git pull using the www-data specified by apache (the deployed public key is also the user), the above composer operations cannot be executed, the following prompt is displayed when I manually operate composer update on the server:
···
Sudo-u www-data php composer. phar update
Cannot create cache directory/root/. composer/cache/repo/http---packagist.phpcomposer.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory/root/. composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
···
Similarly, I tried to install composer globally and used php/usr/local/bin/composer update.
Search for GG and try to change the/root/. composer directory to www-data and 777
root@localhost:~# ls -la ~/.composer/cachetotal 20drwxrwxrwx 4 www-data www-data 4096 Dec 30 14:53 .drwxrwxrwx 3 www-data www-data 4096 Dec 30 14:53 ..drwxrwxrwx 2 www-data www-data 4096 Dec 30 14:53 files-rwxrwxrwx 1 www-data www-data 13 Dec 30 14:53 .htaccessdrwxrwxrwx 3 www-data www-data 4096 Dec 30 14:53 repo
In addition, the composer. phar and/usr/local/bin/composer owner of the project root directory are set to www-data, and the problem persists.
Ask how to solve the problem.
Ps: add,There is no problem with performing operations such as composer update with root.
Reply content:
The project is put on github and a webhook is made. The server detects the post from github. If the master node changes, execute
cd /path;git pull git@ooxxx.com
There is no problem with pulling the code above.
At the same time, if the compoer. json in the master branch is modified, run the following command:
php composer.phar updatephp composer.phar dump-autoload -o
Because the post data from github is executed by git pull using the www-data specified by apache (the deployed public key is also the user), the above composer operations cannot be executed, the following prompt is displayed when I manually operate composer update on the server:
···
Sudo-u www-data php composer. phar update
Cannot create cache directory/root/. composer/cache/repo/http---packagist.phpcomposer.com/, or directory is not writable. Proceeding without cache
Cannot create cache directory/root/. composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
···
Similarly, I tried to install composer globally and used php/usr/local/bin/composer update.
Search for GG and try to change the/root/. composer directory to www-data and 777
root@localhost:~# ls -la ~/.composer/cachetotal 20drwxrwxrwx 4 www-data www-data 4096 Dec 30 14:53 .drwxrwxrwx 3 www-data www-data 4096 Dec 30 14:53 ..drwxrwxrwx 2 www-data www-data 4096 Dec 30 14:53 files-rwxrwxrwx 1 www-data www-data 13 Dec 30 14:53 .htaccessdrwxrwxrwx 3 www-data www-data 4096 Dec 30 14:53 repo
In addition, the composer. phar and/usr/local/bin/composer owner of the project root directory are set to www-data, and the problem persists.
Ask how to solve the problem.
Ps: add,There is no problem with performing operations such as composer update with root.
www-data
No read/write permission/root
Directory.
Change the cache directory.
Https://getcomposer.org/doc/03-cli.md#composer-cache-dir