I have Laravel 5.4 installed on my Mac using Composer and MAMP Pro. The installation completed successfully, but when I try to load localhost/lsapp/public, an UnexpectedValueException error is returned. I have checked the file permissions for the storage and logs directories and both are set to 755 using the command line. It seems the log file cannot be written for some reason. Any suggestions?
Full permission denied message: The stream or file "/Applications/MAMP/htdocs/lsapp/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
in StreamHandler.php (line 107)
When you go into a production environment, I'd recommend the following:
755 permissions for the /log
644 permission for the files inside
For example if you're using apache:
The user owner of the directory (www-data) can read, write and execute.
The assigned group (www-data, where my user is) can read and execute, but not write.
Everyone else can read and execute, but not write.
I just faced the same issue with my installation. Here's what I did to solve it:
Make sure that www-data (or your web server's user) is either the owner or group's owner of the logs directory.
Then make sure that this user have read-write-execute on that folder. On linux I used 770 for that folder. Then laravel is now working fine.
Hope that's help!
Related
I uploaded my laravel 7 app on live server but when I run it I got this error:
The stream or file "G:\PleskVhosts\alajamiaccounting.com\site\storage\logs/laravel.log" could not be opened: failed to open stream: Permission denied
I tried to change storage folder permission but still not fixing the issue, what should I do?
That means the system or user running the Laravel code was not able to write to the laravel.log file. Check that the user group running the code has permission to write to the storage file and that the storage file has the proper CHMOD permissions
chmod -R 777 storage
I just hosted my laravel application on the server but when I am hitting my domain I am getting the error like:
There is no existing directory at "/home/cybuzz/public_html/myproj/storage/logs" and its not buildable: Permission denied.
I have cleared the cache, given the 777 permission to the storage folder as well but the issue persists the same.
Give permission to write for this directory-
If you dont have much idea about permissions, The simplest solution is
Run this command-
sudo chmod -R 777 /home/cybuzz/public_html/myproj/storage/
I am working on Laravel 4. On remote server I took backup of old laravel.log and created new one and restored old one again by removing newly created one. Since then I am getting error:
Error in exception handler: The stream or file "/var/www/stage/webapp/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/staging_html/webapp/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84
I even change mode and but it did not work either. It's not happening across system, just a particular page.
I am on Amazon AWS
You recreated the file, so the permissions have changed, and apache can no longer access it. Run this in command line to set the permissions:
chown www-data:www-data /var/www/stage/webapp/app/storage/logs/laravel.log
That's if you're using apache. It changes ownership of the file to apache (web server). If the web server user isn't www-data. Find out by typing:
ls -l
In the command line to see what user owns the other files in your laravel directory. Replace www-data:www-data with the user that owns the other web files.
To be clear the left side of the colon is user group and the right side is the user. If you have a specific user group that needs access to those files as well like git or ftp, you may need to set it like this:
git:www-data
ftp:www-data
group:user //generic example
It just depends on your access requirements. If you have questions let me know.
I did an installation of laravel, and copied the files to a xampp hosted folder on the same machine. When I try to visit my index.php file however, I'm getting the following error:
Error in exception handler: The stream or file "/Applications/XAMPP/xamppfiles/htdocs/TestManagement/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/TestManagement/bootstrap/compiled.php:8969
I'm always a bit hesitant about changing permissions, as I've done some pretty bad chmodding before. Was wondering if there was a rule of thumb or expected behavior for this. Should this be 777 or 755?
The Laravel and Monolog documentation appear to contain no reference to the 'right' permissions. You can make it work with restrictive permissions, but be aware of all of the users that need access:
the web server user
cron user (if you run artisan commands via cron)
anyone who manually runs artisan commands.
They will each need read/write permissions to the log files.
Always use 777 on app/storage folder
I recently moved my website to a new host and now am experiencing some broken code..
I have an uploading script that is now returning this:
move_uploaded_file() failed to open
stream: Permission denied in *..
I've set the upload directory to 777 which worked fine, but my script is needed to have top level permissions..
(As the script itself sets permission to directories, does lots of copying etc)
Is there a way in apache I can set the PHP script to the owner of all the folders on my server?
Thanks
Also
When looking in phpInfo()
Under
apache2handler
User/Group nobody(99)/99
Is this related?
I wouldn't go that route, just give it permissions to the defined upload_tmp_dir, or define upload_tmp_dir to be a directory you have access to. If it is that directory you have problems with. If the target is the problem, and you've 777'ed it, something fishy is going on.
Do you have ssh access to your new host? The reason I ask is that it's probably not best to use the username/group as nobody, as most other services would use this too. I would change it to something like apache
You can then update httpd.conf, adding in these two lines (reloading the config after):
User apache
Group apache
Then, run chown apache:apache -R dir_name to make apache own it.
well,
When you are trying to set the permission like "0777", you must be running on same authority.
What I mean is.
For example, your script tells to change a folder/file permission to 0777, but the folder or file already has a permission and that is '0755' so you are not authorised to make that change. as the user have only 5 authority.
Either, you need to login to FTP and change the folder permission to 0777 and then you have full control over it or you have to stick with using 0755 or similar.