Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Olav van Schie:
Make your Laravel App Fly with PHP OPcache
Jun 14, 2017 @ 10:16:21

On his Medium site Olav van Schie shows you how to "make your Laravel app fly" with the help of OPcache. While OPcache isn't something that's specific to Laravel, he does include a package near the end that makes it easier to use it with the caching built into "artisan".

Every time you execute a PHP script, the script needs to be compiled to byte code. OPcache leverages a cache for this bytecode, so the next time the same script is requested, it doesn’t have to recompile it. This can save some precious execution time, and thus make your app faster (and maybe save some server costs).

He starts with a brief overview of OPcache and the main benefit it provides. He also shares some benchmarks he performed on a Digital Ocean server based on the results of performance testing the default Laravel "welcome" page. He then shows how to check and be sure it's installed and enabled on your PHP installation and some good default settings to configure in your php.ini. The post wraps up mentioning the package that helps integrate it with the Laravel application and the command required to clear out the OPcache on deploy.

tagged: laravel application opcache caching opcode performance tutorial

Link: https://medium.com/appstract/make-your-laravel-app-fly-with-php-opcache-9948db2a5f93