Initially I was trying to update to Laravel 5.6 from 5.5, however nothing works anymore since I ran composer update. I can't even go back to 5.5, always get the same error:
In Filesystem.php line 122:
file_put_contents(C:\Users...\laravelprojectroot\bootstrap/cache/packages.php): failed to open stream: Permission denied
I tried deleting the cache, deleting vendor dictionary and deleting packages.php. Once I ran composer update, I cannot edit or delete packages.php even with root permission on my laptop.
Please help.
Open cmd prompt or git bash with admin privilege, That solves this issue.
Create these directories if they don't exist:
storage/framework/cache
storage/framework/sessions
storage/framework/views
Then delete bootstrap/cache files
Test if it works, if not, try giving the correct permissions to the storage folder: chmod -R 775 storage/
Related
I'm having some weird problem with Laravel 8.
I installed the framework and started working with it, but when I try to edit / delete some controller, my Ubuntu asks for a password.
Another problem. My controller displays records on a page with paginate(15) pagination, but instead of the usual numbers, I get the Previous & Next direction, and when I try to change something in the html template, I get an error file_put_contents(/var/www/storage/framework/views/c6d615eb91fe3a0edd449165e94d034703bbb84d.php): failed to open stream: Permission denied and this problem can only be cured by clearing the cache, but this should not be the case.
Error #1: Your user does not have write permissions for those files/directories. Did you use sudo while installing or copying anything? Do you have these files outside of your home directory? (/home/username/)
Error #2: Your webserver (nginx, apache, etc.) probably does not have access to the application's /storage/ directory.
SSH into the server.
Navigate to the projects root folder.
Run the following commands to make the directories writable:
sudo chmod -R gu+w storage/
sudo chmod -R guo+w storage/
sudo chmod -R gu+w bootstrap/cache/
sudo chmod -R guo+w bootstrap/cache/
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?
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
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?
I'm pretty new at laravel,Actually when i create this command php artisan migration so i face this error how can i resolve this issue thanks.
Error
UnexpectedValueException : The stream or file
"/home/zubair/htdocs/project/storage/logs/laravel.log" could not be opened: failed to open
stream: Permission denied
If you run the command with sudo or chmod -R 755 some of the project's folders, you'll have it working.
sudo chmod -R 755 storage bootstrap/cache
Changing entire project folder's permission is probably not a good idea as your project becomes accessible to any user/script which kind of defeats the purpose of securing it behind root.
change a permission of storage folder
sudo chmod -R 775 /var/www/html/your-project/storage
for more info check this link install laravel in apache
when I moved my laravel project from local machine to production server, I'm keep getting the following error :
(1/1) ErrorException
file_put_contents(/var/www/html/something/storage/framework/views/1a753601712c44f3634dc18d99a244ad1fb3c3b8.php): failed to open stream: Permission denied
I've tried below possible solutions so far :
php artisan cache:clear
chmod -R 777 storage/
composer dump-autoload
my laravel project folder also has required permissions and is owned by apache user.
I've tried a bunch of other possible solutions but nothing worked for me.
my laravel version is 5.5, apache 2.4, centOs 7, php 7.1.14 .
any idea guys?
It might also be an SE Linux issue - you could try temporarily disabling SELinux (enter setenforce 0 as root). If that fixes it, you might want to try changing the SELinux security context (enter this from the laravel root directory).
chcon -Rv -t httpd_sys_rw_content_t storage/
I have just transferred my laravel application to another pc and I have installed composer. I am running composer install at the root of the project but it shows the following error:
{"error":{"type":"ErrorException","message":"file_put_contents(\/meta\/services.
json): failed to open stream: No such file or directory","file":"C:\\national-fl
eet\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php","l
ine":71}}
I tried CACLS -R 755 app/storage (as admin)
and then composer update but the same error. bootstrap/compiled.php doesn't exists in my project. What should I do?
I got this error, because some folders in /app/storage were missing
To fix the error, I manually created the following folders:
app/storage/
app/storage/cache/
app/storage/logs/
app/storage/meta/
app/storage/sessions/
app/storage/views/
then delete the contents of my vendor folder and run composer update again
Try to remove the services.json in /meta (or rename it to something else) and try composer install again (or composer update). It is possible that the file hasn't got the correct rights for Laravel to write to.