Could not open stream using laravel install

I try to start Laravel, and after installation I get the following when trying to start a new application:

using code: laravel new blog

I get:

 PHP Warning: file_put_contents(/var/www/html/laravel_d4381b5ce250405766ef8b9fa784b256.zip): failed to open stream: Permission denied in /home/ren/.composer/vendor/laravel/installer/src/NewCommand.php on line 81 PHP Warning: ZipArchive::extractTo(): Permission denied in /home/ren/.composer/vendor/laravel/installer/src/NewCommand.php on line 99 PHP Warning: ZipArchive::close(): Invalid or unitialized Zip object in /home/ren/.composer/vendor/laravel/installer/src/NewCommand.php on line 101 Application ready! Build something amazing. 
+6
source share
2 answers

It seems that the user you are executing the command with (from the error that I guess ren ) does not have the necessary permissions to write to /var/www/html/ . Try changing the permissions or ownership of this directory. Try:

 sudo chown <user-name> /var/www/html 

Replace <user-name> with your username (e.g. ren ). Then run the install command:

 laravel new blog 
+21
source

Like a noob, it took me a few good hours to figure this out. As far as I understand, you need to start a new project with laravel new <project> in directory 777. Thus, you would like:

  ### make directory and grant full permissions sudo mkdir /var/www/laravel sudo chmod -R 777 /var/www/laravel/ cd /var/www/laravel/ ### run laravel installer laravel new web-project ### move your project in www root sudo mv web-project /var/www/ 

The last bit in which you move the directory is optional, and you can leave it there or transfer it to any place where vhost can be configured.

Personal note: I really hoped the new Laravel application would be easier than that. I'm sure, however, with practice it will be easier :)

-1
source

Source: https://habr.com/ru/post/982649/


All Articles