Ubuntu failed to perform composer update using Www-data

Source: Internet
Author: User
Tags autoload webhook
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-dataThere is no permission to read and write /root directories.

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.