PHP 8.3, Laravel 11
php artisan cache:clear
works on local dev machine, but on staging and production servers fails with:
In Connection.php line 825:
SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: fe_sendauth:
no password supplied (Connection: pgsql, SQL: delete from "cache")
In Connector.php line 66:
SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: fe_sendauth:
no password supplied
In the .env
file, CACHE_STORE
was originally database
, but the same error occurs after setting CACHE_STORE=redis
. The database and cache are both set up with passwords and working fine within the app. Config is not cached. No Docker involved. All other Artisan cache/clear commands work fine.
Why is it not using DB_PASSWORD
from the .env
, and why is it accessing the database at all when CACHE_STORE=redis
?
Tried:
sudo php artisan cache:clear
php artisan config:clear
service nginx restart
service php-fpm restart
reboot
./config/cache.php
'database'
references DB_CACHE_CONNECTION
etc. without default values, so I set the following in .env
:
DB_CACHE_CONNECTION=pgsql
DB_CACHE_LOCK_CONNECTION=pgsql
DB_CACHE_LOCK_TABLE=cache_locks
Same error.
There must be a difference between production and local setups but I can't think of it.
Where can I start debugging?
It was a file permissions problem. The console user didn't have read access of the .env
file, but there was no error at time of reading.
I have been setting permissions as strict as possible and loosening them each time a problem arose... unfortunately this time took too long to realise it was a permissions problem.