Joomla Clean Cache - Delete Failed - joomla

Joomla 1.5: I enabled SSL on a particular menu item. The menu item failed to switch to https, which prompted me to google a solution. One forum said the problem was resolved by clearing the cache. So, I went to tools/clean cache, selected all under "site" and hit the delete button. This resulted in a swag of errors - one for each item I tried to delete, saying "Delete failed: 'index.html'"
Anybody know what's the happs?

If you go to 'Help' -> 'System info' -> 'Directory permissions' in the /administrator/ area of your website you should get a list of folders with info on whether they are writeable or not.
I suspect your /cache/ folder is unwriteable - so you will need to change permissions on the folder in question to allow Joomla/PHP/Apache to delete the files from that folder.

Also check if cache folder is defined corectly. You can change cache folder location in "Site > Global configuration"

Excecute the following command on your webroot
Code:
-bash-3.1$ chmod 777 administrator/backups/
-bash-3.1$ chmod 777 administrator/components/
-bash-3.1$ chmod 777 administrator/language/
-bash-3.1$ chmod 777 administrator/language/en-GB
-bash-3.1$ chmod 777 administrator/modules/
-bash-3.1$ chmod 777 administrator/templates/
-bash-3.1$ chmod 777 components/
-bash-3.1$ chmod 777 images/
-bash-3.1$ chmod 777 images/banners/
-bash-3.1$ chmod 777 images/stories/
-bash-3.1$ chmod 777 language/
-bash-3.1$ chmod 777 language/en-GB
-bash-3.1$ chmod 777 language/pdf_fonts/
-bash-3.1$ chmod 777 media/
-bash-3.1$ chmod 777 modules/
-bash-3.1$ chmod 777 plugins/
-bash-3.1$ chmod 777 plugins/content/
-bash-3.1$ chmod 777 plugins/editors
-bash-3.1$ chmod 777 plugins/editors-xtd/
-bash-3.1$ chmod 777 plugins/search/
-bash-3.1$ chmod 777 plugins/system/
-bash-3.1$ chmod 777 plugins/user/
-bash-3.1$ chmod 777 plugins/xmlrpc/
-bash-3.1$ chmod 777 templates/
-bash-3.1$ chmod 777 cache/
-bash-3.1$ chmod 777 administrator/cache/
-bash-3.1$ chmod 777 logs/
-bash-3.1$ chmod 777 tmp/
-bash-3.1$ chmod 777 configuration.php
-bash-3.1$ chmod -R 777 cache/
-bash-3.1$ chmod -R 777 administrator/cache/
Then go to TOOLS -> CLEAN CACHE on the administrator site and select all and delete.
The above steps fixed my issue.

Related

Laravel The stream or file "storage/laravel.log" could not be opened in append mode: failed to open stream: Permission denied in RHEL8

I need help here. I installed Laravel in my RHEL 8 Server
But I'm getting this error. I know this question already posted many times but I tried to follow the suggestion but no luck for me so far. I have no idea why.
The stream or file "/var/www/html/vpa/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied
I tried to use this command to change the permission but it didn't work .
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
sudo chmod -R 755 storage
sudo chmod -R 755 bootstrap/cache
sudo setenforce 0
sudo chcon -t httpd_sys_rw_content_t storage
php artisan config:clear
php artisan config:cache
composer dump-autoload
sudo systemctl restart httpd
sudo reboot
Nothing seems to work on my side . I don't know what else to do. Please help me
on ubuntu this step solved it
php artisan config:clear
php artisan cache:clear
sudo chmod -R 775 /var/www/your_folder
sudo chown -R www-data:www-data var/www/your_folder
sudo chmod +w storage/logs/laravel.log
Never use 777
Those are irresponsible permissions
I had changed my storage permission by run following command.It works for me:
step 1:
sudo chmod -R +rwX .
step 2:
sudo chown -R $(whoami) .
In my case, apart from ensuring all permissions were correct, I also had to disable SELinux.
this work for me
sudo chown -R www-data:www-data ./storage
find ./storage -type d -exec chmod 775 {} \;
find ./storage -type f -exec chmod 664 {} \;
sudo chown www-data:www-data ./bootstrap/cache -R
find ./bootstrap/cache -type d -exec chmod 775 {} \;
sudo chown -R www-data:www-data .env
find .env -type d -exec chmod 775 {} \;
Worked for me.
sudo chown -R $USER:$USER /var/www
sudo chmod -R 755 /var/www
sudo chmod -R 755 storage/*
sudo chmod -R 755 bootstrap/*
Simply Read/Write Permission Allow run this commnad
chmod -R 755 /storage/laravel.log”

Setting proper permissions for laravel logs

I cannot figure out how to set up proper permissions for my storage/logs folder.
I am trying to run an artisan command in the console and I am getting an error saying The stream or file "/var/www/html/laravel-project/storage/logs/laravel-2019-05-04.log" could not be opened: failed to open stream: Permission denied.
Current permissions
drwxrwxr-x 6 www-data www-data 4096 May 3 02:45 storage
drwxrwxr-x 2 www-data www-data 4096 May 4 09:44 logs
-rwxrwxr-x 1 www-data www-data 294932 May 4 19:58 laravel-2019-05-04.log
At first I set my permissions like
1)
sudo chown -R www-data:www-data root/of/laravel/project
2) Added my user Ubuntu to the www-data group
sudo usermod -a -G www-data ubuntu
3) Set all files to 644
sudo find /root/of/laravel/project -type f -exec chmod 644 {} \;
4) Set all directories to 755
sudo find /path/to/your/laravel/root/directory -type d -exec chmod 755 {} \;
If I would run commands like in the console that caused an error I would get an error saying I did not have permissions to write to the log
So I tried it this way
1) Change owner of all directories to myself
sudo chown -R ubuntu:www-data /root/of/laravel/project
2) Give myself and the server permissions
sudo find /root/of/laravel/project -type f -exec chmod 664 {} \;
sudo find /root/of/laravel/project -type d -exec chmod 775 {} \;
3) Give the webserver read & write permissions for storage and cache folders
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
What is the proper way to set permissions properly so that I my user can write to the storage folder AND the web server can as well?

Set permission to user and folder - laravel 5.1

Today with GIT I update my app but after that I got Internal Server Error.
I try to solve problem with command:
sudo chown -R ireserve:ireserve /home/ireserve/public_html
and
chgrp ireserve -R /home/ireserve/public_html
but again the same error:
here is my folder permissions:
Any idea what is a problem and how to solve?
I also try this commands:
find public_html/ -type d -exec chmod 755 {} \;
find public_html/ -type d -exec chmod ug+s {} \;
find public_html/ -type f -exec chmod 644 {} \;
chown -R ireserve:ireserve public_html
chown -R ireserve:ireserve public_html
chmod -R 777 public_html/storage
chmod -R 777 public_html/bootstrap/cache/

how to display files with permission number in mac terminal?

I have tried:
stat -c '%a %n' *
this does display what I want, but this runs in amazon ec2.
Im running on my mac, when I tried to run:
sh-3.2# stat -c '%a %n' *
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
sh-3.2#
The format that I would like to see is:
755 app
644 artisan
755 bootstrap
644 composer.json
644 composer.lock
755 config
755 credentials
755 database
644 package.json
644 package-lock.json
644 phpunit.xml
755 public
755 resources
755 routes
644 server.php
777 storage
755 tests
755 vendor
644 webpack.mix.js
777 worker.log
644 yarn.lock
This displays if I used this command stat -c '%a %n' * in AWS ec2 linux instance.
Hopefully this will work for you:
stat -f "%p %N" * | awk '{$1=substr($1,length($1)-2)}1'
755 Benchmark
755 BoundedBuffer
755 CImgGenerateVideo
755 CImgInterpolate
755 Flask
755 Folder
644 LUT.png
755 Mosquitto
644 MrBean.jpg
755 ThreadSync
644 URLs.txt

services.json failed to open stream: Permission denied in Laravel 4

I was playing around with a working Laravel 4 installation and moved everything into a sub folder. Then I decided to not do that and I moved it all back (all via the command line):
mv * /folder
and then
cd folder
mv * ../
Now, the site is throwing the following error:
file_put_contents(/var/www/quantquote/app/storage/meta/services.json): failed to open stream: Permission denied
Here is a screenshot of the full error:
http://i.imgur.com/8deGG97.png
I've already tried setting permissions on the /storage folder to 777 to no avail.
Spent a whole day for solving this and this command simply solved my problem.
If your permissions are 777 for Laravel App folder and you still get this error, it's because SEliux has blocked it. You can easily unblock your application's folder using this command:
su -c "chcon -R -h -t httpd_sys_script_rw_t /usr/share/nginx/YOUR_LARAVEL_APP/"
That's it!
BTW never disable SElinux: http://stopdisablingselinux.com/
As I stated in my comment:
find app/storage -type d -exec chmod 777 {} \;
find app/storage -type f -exec chmod 777 {} \;
This will chmod all directories and files in app/storage to 777.
As the problem is related to permissions try re-giving the right permissions to app/storage and all its sub-directories and file.
You can do so from the root path of your Laravel app typing:
chmod -Rvc 777 app/storage
If for some reason this doesn't work, try:
find app/storage -type d -exec chmod -vc 777 {} \;
find app/storage -type f -exec chmod -vc 777 {} \;
When chmod 777 or chmod 775 fails check that subdirectories really exists:
app/storage/
├── cache
├── logs
├── meta
├── sessions
└── views
in case these folders does not exists you must to create it:
cd app/storage/
mkdir meta logs cache sessions views
cd ../
find storage -type d -exec chmod 775 {} \;
find storage -type f -exec chmod 664 {} \;
UPDATE 2016 for laravel 5+
In a default Laravel 5+ application structure, storage is at the same level than app. So the previous command becomes:
cd storage/
mkdir meta logs cache sessions views
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;
https://laravel.com/docs/5.0/structure
If you're using CentOS7, follows these steps:
Change app/storage directory ownership
chown apache:apache app/storage
Change app/storage permissions
chmod -R 775 app/storage
Prevent SELinux from blocking the app/storage directory
su -c "chcon -R -h -t httpd_sys_script_rw_t [fullpath]/app/storage"
just type this on terminal:
php artisan cache:clear
Never run a 777, in recursive mode. It's a security issue.
For now, remove the services.json file, and try this :
Laravel 4: Failed to open stream: Permission denied
Try these commands one by one:
setenforce 0
setsebool -P httpd_can_network_connect_db on

Resources