Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

susanne99's avatar

laravel 11: config cache no working

Next problem - it's slowly getting tiring. php artisan config:cache works on my WIN11 development PC. If I do the same on the production server (Debian/Apache) then the bootstrap/cache/config.php doesn't work. I searched them for error paths - found nothing. My program crashes as soon as I try to log in (Laravel Sanctum). if I delete the config.php, everything works again. Unfortunately I can't find anything in the log files

0 likes
13 replies
Snapey's avatar

are you using .env variables in anywhere other than in config files?

susanne99's avatar

@Snapey hi, I only use env in the config files. I searched the whole project for that Above all, I don't understand one thing at all, the cache/config.php file is the collection of my config files and those of the vendors. That's why it should work. Yes, the paths must be adapted to the respective environment and the access rights to folders must also be appropriate. You can exclude the rights, otherwise it would never work. I don't understand the concept of caching in this context either. I mean, whether I load an Allin file or several files into memory once doesn't make a big difference to me. But I think that the individual config files are always reloaded with every request - that's strange anyway!?

Snapey's avatar

I searched them for error paths - found nothing

what does this mean?

susanne99's avatar

@Snapey This means that the paths on the development PC are different than on the production machine, i.e. c:\myapp or /myapp

JussiMannisto's avatar

It could be a lot of things.

There should definitely be something under storage/logs if your app crashes. If you see nothing, the file or directory permissions are probably incorrect. Your storage files should be owned by the Apache user (usually apache, httpd or www-data) so that it can write logs.

You should also check the web server logs.

susanne99's avatar

You're right, but it's not as easy as you think - otherwise I would have already found the error. yes, it certainly is, well, only my log files are in storage/logs (I have a logger myself), so it's not the folder permissions - unfortunately! Unfortunately there is nothing in the /logs folder either. I would have to turn on php logging - let's see. In Laravel I configured debug=true.

I'm not a fan of PHP, I come from the C# world, but the customer is king, but that's another story

susanne99's avatar

juhu, i have got one error: but i do not why, the rights are correct. The strange thing is that if I delete the bootstrap/config.php, then everything is fine and the pmslog.log file is created. That's crazy, right?!

file_put_contents(): open_basedir restriction in effect. File(/apps/pms_v1/backend/storage/logs/pmslog.log) is not within the allowed path(s): (/var/www/vhosts/hosting132071.a2e25.netcup.net/:/tmp/:/var/lib/php/sessions)

so, i chnaged the open_basedir path - but the error still exists: file_put_contents(): open_basedir restriction in effect. File(/apps/pms_v1/backend/storage/logs/pmslog.log) is not within the allowed path(s): (/var/www/vhosts/hosting13.a2.netcup.net/apps/pms_v1/backend/:/tmp/:/var/lib/php/sessions:/var/www/vhosts/hosting13.a2

The internet is full of this error, it's unbelievable that it still exists

susanne99's avatar

The problem is that in Laravel the base directory is "public", but the storage path is above. But that only causes problems if you don't delete the boostrap/cache/config.php - strange, I just don't understand it!!

As soon as there is the file cache/config.php, he has an open_basedir problem - generally!!!. hint: my document_root is the public folder. but again, as soon as i delete the cache/config.php file - everything is working !!!

susanne99's avatar

I give up after a few hours of debugging and trying, I can't find the error. It's all done so illogically - crazy. I just live without the cached config file, then it works. I'll be happy when this project is over and I can go back to .net core - sorry!!

Snapey's avatar

The internet is full of this error, it's unbelievable that it still exists

Unfortunately there is a lot of bad application hosting guidance out there.

susanne99's avatar

@Snapey Yes, that's right, but I wouldn't have that much of a problem with it. What I don't understand is why a cached config entire file changes the behavior of Laravel - I just don't understand that. You can kind of see that it has become a "patchwork". I did a bit of research, the open_basedir itself is correct, but some of the paths are really wrong, so for example the "vendor" path is suddenly in the middle my log path in it, etc. If I were Laravel I would investigate this problem, the internet is full of it. The only answer I got from them was that there was certainly no mistake in it - well then, it won't - it will haunt you for the rest of your life - mistakes just don't go away - that's how it is!!!

And the best thing about the story is that I still need this cached config under Win11 xampp (my development machine), because otherwise Laravel can't handle the concurrent requests from the client. putenv and getenv from vlucas are not thread safe!!! etc etc

Snapey's avatar

@susanne99 but thats all complete rubbish. tens of thousands install and work with laravel daily, on all types of platform. You have to ask yourself, what is non-standard about my setup.

Try a brand new project with no changes and see if that runs ok.

1 like
susanne99's avatar

@Snapey Just because so many things work doesn't mean there isn't a bug in there. if I e.g. If you set "open_basedir" to "no value" on the web server, the cached config file works. I think someone didn't do the "order query" properly.

Maybe a brand new one will work, but that doesn't help me. I followed the upgrade procedure, there's nothing more I can do. But whatever, I don't mind, I'll get rid of the project soon and then never use PHP again, sorry, but that's not a language for professional use. oop alone with his type security is complete madness

Please or to participate in this conversation.