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

chrislentz's avatar

Issue deploying Laravel via DeployBot.

Anyone using DeployBot for Laravel deployments?

I have been using it on non-laravel projects for sometime, but just started with a Laravel project.

Everything is setup to have a shared vendor directory, storage directory, and .env.

What I am finding, is that view/blade changes I deploy are not showing up. I have to reboot my server to get them to show up. I tried clearing the storage/views contents on deploy, but that didn't help.

Does Laravel (5.1) do anything else related to view compiling/caching that I might need to do on deployment?

0 likes
14 replies
bashy's avatar

Does it have release folders? Maybe it's using an old folder that has the original version. Try dumping something in a route and see if you can get that working. If it's just blade template files, there is a cache folder that stores them.

chrislentz's avatar

@bashy It does have releases, but it seems like the current directory is properly symlinked to the correct releases folder.

TylerODonnell's avatar

Could you possible try to reload/restart your web server (ie nginx) after the deployment has completed and the symbolic link has been properly linked?

chrislentz's avatar

@TylerODonnell That is what I am currently doing to make sure the deployment works. I will check if the symlink is updating correctly prior to the restart.

chrislentz's avatar

So I confirmed that the symlink is updating correctly after the deployment.

Is there any other kind of caching that laravel does on views? Anything that is maybe in the memory?

This is so strange.

bashy's avatar

You can delete/clear the cache with this

php artisan view:clear

or just delete the files in the storage folder.

TylerODonnell's avatar

I run a bash script when I deploy my Laravel projects and I've never ran into this problem which is strange. Once the symbolic link changes, the new version immediately appears. It was worth a shot trying to restart the web server.

Here's a link to the deployment script I use if that helps you at all. (It pretty much emulates exactly how Envoyer does its deployments.)

chrislentz's avatar

@bashy & @TylerODonnell I tried both your solutions (php artisan view:clear & service nginx restart neither worked.

What did work is restarting PHP-FPM service php5-fpm restart.

Do either of you know what sort of caching PHP-FPM is doing?

I am a little concerned that doing a service php5-fpm restart on each deployment will cause it to not be a "Zero Downtime Deployment".

chrislentz's avatar

Ok, I did some research and it looks like php5-fpm caches the symbolic link path so when the link path changes, it doesn't automatically receive the chances.

I am curious how other have solved this problem.

Should I just restart the service with each deployment or can I request a cache update?

1 like
chrislentz's avatar

I am thinking this is probably the best approach to call on deployment.

service php5-fpm reload
TylerODonnell's avatar
Level 28

That's good to hear you figured out what was causing the problem. I run the same setup and don't have to restart PHP. I bet you can change some configuration to get it working.

Doing some quick research, I found that you can use the $realpath_root in Nginx (if you're using Nginx) to get symbolic links working like you'd expect. http://stackoverflow.com/questions/23737627/php-opcache-reset-symlink-style-deployment/23904770#23904770

I just looked at my configuration and I'm using that.

You'll just have to put it inside your PHP block like

location ~ \.php$ {
    ...configuration that fits your server here...

    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT $realpath_root;
}
2 likes
chrislentz's avatar

@TylerODonnell Yes, I was actually testing that same solution as you replied. That was the issue. It is a fastcgi_param issue. You have to use $realpath_root to get FastCGI to correctly resolve the symlinks.

Here are some links for others that come across this thread: http://stackoverflow.com/questions/23737627/php-opcache-reset-symlink-style-deployment/23904770#23904770 http://nginx.org/en/docs/http/ngx_http_core_module.html#var_realpath_root

Thanks for your help!

2 likes
bashy's avatar

Ah should of remembered since someone posted the same problem. Even symlinks are cached for a certain amount of time :)

1 like
matz's avatar

Awesome, this is still valid. Thank you guys :)

Please or to participate in this conversation.