Skip to main content

By Jesse Schutt

Running Artisan Commands in Envoyer

Along with the launch of the new we’ve been working on a Laravel app that collects statistics from a variety of sources related to our work & life as ZaengliansTM.

As the number of stats have increased, we needed a way to condense this data into an easy-to-read format. I bumped into the following problem as I was working on the section of code that aggregates the statistics.


Make sure to exit out of your current path, and re-enter it in order to get the latest symlinked release code OR you can avoid navigating into the current directory at all by running the command like this: php current/artisan stats:recount-all.


Earlier this morning I was attempting to run an artisan command while ssh'ed into my Forge box. I'm using Envoyer to deploy this project, so I had logged in to the server, and typed cd current to move into my current deployment. I ran my artisan command php artisan stats:recount-all and noticed a problem with the code.

After fixing it locally, committing and pushing it to Bitbucket I waited a few minutes for Envoyer to auto-deploy it to Forge.

Once the deployment was done, I hit php artisan stats:recount-all to trigger the command again. Gah! My fix didn't work.

So I attempted to dig deeper into the code locally to try and find out what wasn't working. All my tests passed with the changes, and I confirmed that the command was working on my local machine.

Still no dice on the Forge box though.

I pulled a copy of the remote DB and ran the command locally again. It worked just fine.

Maybe it was a casing issue? I know servers can be picky about mixing upper/lowercase, so I double checked and couldn't find anything that looked strange.

Finally I completely disabled a portion of the code that would have to throw an error if it were executed. I pushed that to my repo and after confirming Envoyer had deployed it, ran the command through the terminal. STILL NO ERROR. Grr.

Then it occurred to me... Envoyer keeps a few past deployments in a directory called releases and only symlinks the latest release to the current directory. I wondered if maybe my terminal path wasn't updated and the current directory I was in wasn't actually the latest release.

cd ../

cd current

php artisan stats:recount-all

Bingo! It worked!

Want to read more tips and insights on working with a website development team that wants to help your organization grow for good? Sign up for our bimonthly newsletter.

By Jesse Schutt

Director of Engineering

Jesse is our resident woodworker. His signature is to find the deeper meaning in a project and the right tool for the job.