Laravel Forge: PHP7 and bzip2
This article has been published a while ago.
If this is a technical article some information might be out of date. If something is terribly broken, let me know and I will update the article accordingly.
In the last weeks, I finally got my Mojo™ back and began working on Screeenly again. One thing that bugged me the most in the last months was the performance of the app. I currently host it on uberspace which is meant for small sites or projects that don't use a ton of memory (phantomjs uses a lot of memory).
I always wanted to try a Cloud Hoster like Digital Ocean for one of my projects and I think Screeenly finally deserves its own server. The cost and my not existing devops knowledge always scared me off this idea. But Forge comes to the rescue.
The Bug Hunt #
I set up all accounts and began tinkering around. For hours I couldn’t figure out, why composer and one of my used packages would try to download phantomjs
4 times, exit with a Successful download
message but wouldn’t put the binary in the correct place.
After reading the actual PHP Code of the package which get’s executed the problem was found. Zip-extraction failed.
But how on earth could I fix that? (Sidenote: I still have no experience in devops. 😂)
The Solution #
After some research, the solution was so simple I couldn’t believe it. Just execute a one-liner and restart the server … done.1
sudo apt-get install php7.0-bz2
The Verdict #
- Forge doesn’t install the
bz2
extension automatically - Packages are not perfect, but PRs make them better
¯\(ツ)/¯
-
Or you could add
extension=bz2.so
to yourphp.ini
file and restart the server ↩