The project was placed on GitHub, made by a webhook, and its own server detects post from GitHub, and if Master has a change, executes
cd /path;git pull git@ooxxx.com
There is no problem in pulling the substitution code above.
At the same time, it also detects that the Compoer.json in the master branch is changed when it is executed:
php composer.phar updatephp composer.phar dump-autoload -o
Since the post data from GitHub is executing git pull with the www-data specified by Apache (the public key of the deployment is also the same user), it is not possible to perform the above composer operation, I manually operate on the server composer update The following prompt appears:
···
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 the package information
Updating dependencies (including Require-dev)
Generating autoload files
···
Again, I try to install composer globally, and the same error is with Php/usr/local/bin/composer update.
Search on GG, 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 to the project root directory of the Composer.phar and/usr/local/bin/composer owners are set to become the Www-data, the problem remains.
Ask how to solve.
PS: To add, do not have any problems with root composer update operation.
Reply content:
The project was placed on GitHub, made by a webhook, and its own server detects post from GitHub, and if Master has a change, executes
cd /path;git pull git@ooxxx.com
There is no problem in pulling the substitution code above.
At the same time, it also detects that the Compoer.json in the master branch is changed when it is executed:
php composer.phar updatephp composer.phar dump-autoload -o
Since the post data from GitHub is executing git pull with the www-data specified by Apache (the public key of the deployment is also the same user), it is not possible to perform the above composer operation, I manually operate on the server composer update The following prompt appears:
···
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 the package information
Updating dependencies (including Require-dev)
Generating autoload files
···
Again, I try to install composer globally, and the same error is with Php/usr/local/bin/composer update.
Search on GG, 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 to the project root directory of the Composer.phar and/usr/local/bin/composer owners are set to become the Www-data, the problem remains.
Ask how to solve.
PS: To add, do not have any problems with root composer update operation.
www-data
There is no permission to read and write /root
directories.
Change the cache directory.
Https://getcomposer.org/doc/03-cli.md#composer-cache-dir