Laravel site on live server permission issue - php

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

Related

Why laravel project is throwing an error on the server like There is no existing directory at "/home/....... and its not buildable: Permission denied?

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/

Laravel 5.4 laravel.log permission issue

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!

Laravel 5.1, failed to open stream: Permission denied

I am having a challenge uploading a file into app/storage. Upon uploading the file I get this error:
file_put_contents(C:\xampp\htdocs\ProjectName\storage\app\folderName): failed to open stream: Permission denied.
I tried using chmod -R 777 storage/app, but still have the same problem.
Would really like know how to solve this problem.
Make sure apache has write access to PHP's temp folder (C:\xampp\tmp\ usually) as well as all of storage (not just storage/app). Also, be sure the uploads folder actually exists (C:\xampp\htdocs\ProjectName\storage\app\folderName).
PHP first uploads files to the tmp folder, and then moves them into storage.
Here's how to change permissions in Windows 7.

Laravel Permissions

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

permission for my php to create a dynamic file on the server

For a project I need my php file to create a dynamic file (on remote server which I bought) which loads into a flash component. Everything is working fine on my localhost. But once I upload it to the server, it throws the following errors:
Warning: fopen(output.html) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 25
Warning: DOMDocument::save(k_id.xml) [domdocument.save]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 136
where on those lines fopen is written.
I understood as there is no permission to my php file to create any dynamic files on the server. So i just wanna understand is there a way by which I can privilege my php to create that file on the server.
I've the login access, which I think I've to put somewhere in code before it tries to create such file...but i dont know how to figure this...any suggestions?
The user that runs the PHP process needs to have permissions to write new files in the target folder. On linux servers this is done using CHMOD.
chmod 777 -R /path/to/folder
777 is the permission (full permission for testing only), -R means recursive for the files/folders inside. As you are using windows just right click on the folder and look at properties and search for permissions.
Create a new directory where the PHP will write the files. For that directory set permissions to 705 (that is owner has Read, Write, Execute permission)
You can either do that using a FTP client (Filezilla) or via a Bash shell
mkdir inputfiles
chmod 705 inputfiles

Categories