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

jakeryansmith's avatar

Using Envoy as alternative to Envoyer but having trouble

With Envoyer being down, I thought I could write an Envoy script to handle my deployments in the interim. This is what I have so far for activating the latest release. The problem is the symlink seems to update fine (I can verify this point to the correct release using ls -l) but ngix wants to keep loading from the previous release, like it's ignoring the updated symlink and going of that it used to be. I can verify this by changing the name of the previous release, as this return the "no input found" error.

Here is part of my Envoy script:

ln -nfs /home/forge/myapp.com/releases/{{ $release }}/ /home/forge/myapp.com/current;

Any help will be much appreciated!

0 likes
6 replies
michaeldyrynda's avatar
Level 41

You'll need to run sudo service nginx reload as part of your deployment script, otherwise nginx won't follow the symlink to the new directory.

Edit: Actually, it may be sufficient to just reload FPM (sudo service php5-fpm reload).

In the event that it's not, you'll need to add the following to /etc/sudoers

# Allow forge user to reload nginx
forge ALL=NOPASSWD: /usr/sbin/service nginx reload

#includedir /etc/sudoers.d

Make sure you add it before the includedir line.

jakeryansmith's avatar

@deringer I already tried restarting nginx, it doesn't seem to matter. It doesn't seem like nginx would need restarted if all I am doing is changing an existing symlink, isn't that the point of the symlink, so it can be easily changed without disrupting anything?

Thanks!

bashy's avatar

You have to restart/reload it to recache the real path. realpath_cache_size and realpath_cache_ttl settings are in php.ini

http://php.net/manual/en/ini.core.php#ini.sect.performance

Duration of time (in seconds) for which to cache realpath information for a given file or directory. For systems with rarely changing files, consider increasing the value.

2 likes
jakeryansmith's avatar

@deringer So I just tested it again, and had the same issue, but I noticed something. I went into my releases folded and delete the old releases then it started working.

jakeryansmith's avatar

@bashy Ok so you are saying that nginx is pointing to the correct release, it's just that when the index.php page is hit and bootstraps the application, it's still loading from the old release because the path has been cached?

jakeryansmith's avatar

@deringer Ok cool runig php5-fpm reload worked. Now it makes sense, it seems the problem wasn't nginx or even the symlink not working, it was as @bashy pointed out, PHP was caching the real path which was causing laravel to load old files when bootstrapping the application.

Please or to participate in this conversation.