i need help in laravel 5.4 permission denied - php

it gives me this error when i put laravel on apache server
The stream or file "/var/www/app/storage/logs/laravel-2019-01-02.log" could not be opened: failed to open stream: Permission denied
i have tried everything i set permission to 777 and set owner to root and i try permission 775 also didnot work can any one help me with this...?
note: i am working on apache server on CentOS7

It's a permission issue:
Just Open Your CMD -> Go to your project folder -> Run the following command:
sudo chmod 777 storage/

i fix it...
after using this command i still didnot know what is the reason
1.cd /var/www/html
2.setenforce 0
3.service httpd restart

Related

Laravel: while hosting xampp on localhost in mac getting an error UnexpectedValueException

I am just starting with laravel, when I localhost it in xampp(localhost:8080/app/public) in mac [where app is a file created when I created] it shows an error
`UnexpectedValueException
The stream or file "/opt/lampp/htdocs/app/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied`
Please help me with this.
It looks that laravel doesn't have permissions to create logs so come to the root directory of the project and run this command from your terminal
sudo chmod -R 775 .
in your case, your project is in this path /opt/lampp/htdocs/app so move to it first then change permissions like this
$ cd /opt/lampp/htdocs/app
$ sudo chmod -R 775 .

How do I fix laravel.log cannot be opened in AWS deploy?

We have a Laravel app (version 4) that we're trying to deploy on AWS. Previously, it was hosted in our local servers via XAMPP. On AWS, I created a folder for the laravel app in var/www/html directory path. But as I try to access http://aws-url/laravel_folder/public, I get the error message:
Error in exception handler: The stream or file "/var/www/html/laravel_folder/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/laravel_folder/bootstrap/compiled.php:9134
I've checkout all similar questions and have followed the suggestions, i.e. setting permission of laravel.log to 777, but still keep getting the same problem.
How do I fix this problem?
Thank you
First 777 permission is not a good idea.
If you're on linux, use the following command:
chmod -R 770 logs (add sudo in front if you're not the owner of the folder!)
That will give owner and group read-write-execute permission on the logs folder and everything inside it but will give no permission to other users.
Also make sure that the folder and files inside it have the web server's user as group.
Hope that's help!
You need to set the permissions for the entire storage folder to 777
sudo chmod -R 777 storage/

PHP Laravel: failed to open stream: Permission denied

I am trying to generate email but getting this error:
fopen(/tmp/4701021fcbc23c3a52dde64ccca28857/body): failed to open
stream: Permission denied
Relevant user/group have the permissions but its not working. I used lot of links but none is working.
We are running apache server on linux Ubuntu 14.04.4 LTS and using laravel framework.
Try running this commands in the console, is very important to execute them from your project root directory, if you don't it won't find the specific laravel commands:
cd your_project_path
php artisan cache:clear
chmod -R 777 app
chmod -R 777 storage
composer dump-autoload
I found a similar problem in the laravel.io/forum with further information.
Set up write permissions on storage directory inside your Laravel project directory:
chmod -R 777 storage
You need to access your Laravel project folder so you can run the following command
sudo chmod 777 -R 'your path to project'
Of course you have to replace 'your path to project' with the address of your project folder
for example /var/www/html/LaravelNiceProject
thats it
You can try to write command below to grant your apache user needed privileges:
chown www-data -R storage
Regards dear

file_put_contents failed to open stream: Permission denied

I get this error while trying to do file_put_contents().
Apache is working as apache group, started with sudo rights. My user is in apache group. All dirs and files have 755 chmod.
File exists.
Locally it works fine, on remote CentOS server not. Why? How to debug that thing?
Sometimes SELINUX will prevent writing as was my problem serving from Fedora. Run:
sudo setenforce 0
This can be solved by changing directory permission.
Run the command like
chmod 777 database (the directory)
You can use getcwd()" to find the directory path.
Please have a look here

mkdir(): Permission denied in /var/www/vtiger/includes/runtime/Viewer.php

I am trying to install vtiger 6 on my ubuntu system on apache server.
I am getting a error while running it :
Warning: mkdir(): Permission denied in /var/www/vtiger/includes/runtime/Viewer.php on line 58
Warning: mkdir(): Permission denied in /var/www/vtiger/includes/runtime/Viewer.php on line 58
I changed the main folder "vtiger" permission 777 bt its still issue can someone help me??
SSH to your server and do the following:
cd /var/www
chown -R www-data:www-data .
Make sure you run the chown command in the www folder or vtiger folder if you wish, it is really important that you do not run the command from the root, as it could be catastrophic. This should resolve your issue.
When you change the directory permissions to 777 for the /test directory this problem is solved.

Categories