简体   繁体   English

安装 composer (权限被拒绝) Symfony

[英]Install composer (Permission denied) Symfony

For one reason or another, I can't install composer on my system出于某种原因,我无法在我的系统上安装 composer
I am with CENTOS operating system and the html folder has 755 permissions我使用的是 CENTOS 操作系统并且 html 文件夹具有 755 权限

[ErrorException] file_put_contents (/var/www/html/Symfony/vendor/composer/installed.json): failed to open stream: Permission denied [ErrorException] file_put_contents (/var/www/html/Symfony/vendor/composer/installed.json):无法打开流:权限被拒绝

Do you have some suggestions to fix my problem?你有什么建议可以解决我的问题吗?

How are you trying to install composer?你是如何尝试安装作曲家的? You must just be logged in and run these commands:您必须登录并运行以下命令:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Just like written inside https://getcomposer.org/download/ After you'll be done, run this command:就像https://getcomposer.org/download/里面写的一样,完成后,运行这个命令:

mv composer.phar /usr/local/bin/composer

That's enough, you can use composer like these:够了,你可以像这样使用 composer:

composer require ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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