Geoff
Geoff

Reputation: 6649

Yii2 composer returns an error in installation

AM using ubuntu linux in my development

I was installing yii2 advanced template via

composer create-project nenad/yii2-advanced-template advanced

Which starts the installation upto the point when the vendor directories are being installed and it fails with the error

After some research i found out that i need to instal global asset plugin via

composer global require "fxp/composer-asset-plugin:~1.2.0"

But now am getting an error of

Changed current directory to /home/myusername/.composer


  [ErrorException]                                                             
 file_put_contents(./composer.json): failed to open stream: Permission denied                                                                            

I understand its a permission issue and i have

  sudo chomd 0777 -R /var/www/html/yii2/advanced

but this havent solved the file_put_content error

I have tried

   sudo chmod 0777 -R  /home/myusername/.composer

but this also fails

What else do i need to do

Upvotes: 0

Views: 228

Answers (1)

wormi4ok
wormi4ok

Reputation: 632

Using 777 as permission mask is a bad idea. I'd recommend to use chown command instead.

sudo chown -R $USER:$USER /home/$USER/.composer

This will make composer directory owned by your user and you can use 755 for directories and 644 for files.

To make it clear, what problem composer exactly stumbled upon, try running require command with -vvv option. This allows you to run composer in full verbose mode and get debug information.

composer -vvv global require "fxp/composer-asset-plugin:~1.2.0"

Look into ~/composer folder and doublecheck file permissions and owner with ls -al

Upvotes: 1

Related Questions