Ubuntu fails to execute composerupdate using www-data.

Source: Internet
Author: User
Tags autoload webhook
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-dataNo read/write permission/rootDirectory.

Change the cache directory.

Https://getcomposer.org/doc/03-cli.md#composer-cache-dir

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.