Laravel Storage folder permission denied on shared hosting - laravel-9

I have a laravel 9 app hosted on shared hosting. Until earlier today it was working as expected only to start showing the error "domain.com is currently unable to handle this request".When I checked the logs in storage/logs/laravel.log, there were no errors but on setting app_debug to true the app displayed the error message "The stream or file ".../storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied" The permissions of the storage and logs folder are set to 755 and those of laravel.log are 644 hence I do not understand why the log file is not writable.
Once I set the permissions for laravel.log and the storage and logs folders to 777 the app logs errors which further indicate permission errors for other folders and files in the storage folder. From other related questions, I have learned that setting the permissions to 777 leaves your app open to anyone on the internet to read, write and execute files which is definitely a security risk and hence not advisable.
I have tried reuploading the entire project but the result is still the same. I have also tried running these commands as answers to similar questions advised to no avail.
php artisan cache:clear
php artisan config:clear
composer dump-autoload

Related

Apache/nginx 403 when uploading new files

I've been stumped with this for a couple days now. I set up apache on my VPS and am uploading files frequently via FTP to my website. However, when I try to access those links in the browser, Apache gives me a 403 error. When I run the command "chmod 755" on the file and refresh, however, the file is accessed fine. I had the same error when I tried using nginx as my software. Thanks!
I had the same problem. Running command "chmod 755" solved problem but if user upload new file you need to run command again and again...
So I set the default permission for newly uploaded files in /etc/vsftpd.conf
file_open_mode=0755
local_umask=022

Permissions error installing new theme in Concrete5

I've just installed Concrete 5 CMS by following the instructions on the website.
The folders application/files/, application/config/, packages/ and
updates/ will need to be writable by the web server process. This can
mean that the folders will need to be "world writable", depending on
your hosting environment. If your server supports running as
suexec/phpsuexec, the files should be owned by your user account, and
set as 755 on all of them. That means that your web server process can
do anything it likes to them, but nothing else can (although everyone
can view them, which is expected.) If this isn't possible, another
good option is to set the apache user (either "apache" or "nobody") as
having full rights to these file. If neither are possible, chmod 777
to files/ and all items within (e.g. chmod -R 777 file/*)
The packages folder has permission 777 and root/tmp folder has permission 755.
I've uploaded a new theme to /packages over FTP. When I try to install the new theme I see the following error:
An unexpected error occurred. fopen(/root/tmp/1419851019.zip) [function.fopen]: failed to open stream:
Permission denied
I have FTP access to the server and access to CPanel. How do I get this working without granting too many permissions which pose a security risk?
My install has the folders application/files, application/config, packages, and updates all set to 755 and it's working just fine.
You get that error because the system is trying to write to /root/tmp, which apparently is the environment configuration for a temp folder when your PHP request is handled.
Try adding the folder application/files/tmp in your file system (within your concrete5 installation). And then make sure that the user can write to that folder that is running PHP in your environment. As explained in the concrete5's own documentation (that you linked originally), it depends on your server which user this is.
Usually in shared hosting environments it's the same as the account you use to login there through SSH or FTP. In these cases, the 755 permissions should be enough if your own user owns the tmp folder you just created.

.htaccess Error Msg: I can see it but I couldnt write to it! required permission

I already search the web to find the solution for this I am using joomla as CMS and using DMC firewall but when I logged in in my administrator account I always see this error message ".htaccess I can see it but I couldnt write to it" I am using xampp and linux as a webserver I already change the permission from 777 to 755 to 644 but I still get the error

Folder permissions getting changed when folder is deployed through FTP in cloud 9 IDE

I am trying to deploy a folder using 'Deploy to FTP Server' option in cloud9 IDE. Folder got deployed correctly on the remote location. But when I tried to access the files in folder I encountered error 403 Forbidden. You do not have permission to access this document.When checked through console, permissions got changed. It is not feasible to change the folder permissions each time. What should I do?
Any help will be highly appreciated.

KLogger Permission denied trying to create log file

I have KLogger installed in my web app and everything worked fine on my XAMPP dev server but once I uploaded all my files to my host I get:
<b>Warning</b>: fopen(/var/log/log_2013-08-15.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in <b>/home/user/public_html/site.net/include/KLogger.php</b> on line <b>177</b><br />
So far I have tried setting the permissions to 777 on both the var and log folders but this doesn't help.
Please help me trouble shoot this.
My hosting provider provides CPanel.
As requested I'm answering my own question.
This was my error all the way. In all of my other files I have a couple of defines for the file paths and I didn't add them to my klogger initialization so it was trying to create a text file on the root var/log directory instead of my home directory.