1
votes

I am getting this error while installing Laravel latest version on ubuntu 18.04

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

I have even run the following command as suggested by someone in response to the same question

sudo chown -R myuser ~/.composer

Still same error any ideas?

2
the command you are running will only help if you're running composer global .... What will help if you're just running composer for the current directory is sudo chown myuser composer.* (and possibly deleting vendor in case it also has incompatible permissions)apokryfos
I am running the command inside the same directory as composer.aliencity

2 Answers

1
votes

My error was exactly like below after this command: composer update.

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

Solved it only adding sudo command in ubuntu. Full command will be:

sudo composer update

0
votes

How do you run your php? If it starts when you visit page in browser, then user is www-data and of course there are no permissions.

I think you should try change group of this file:

sudo chgrp www-data ./composer.lock

But I am wondering why do you write into composer lock file? Are you ok?