4332 Grimes Ave N.
Minneapolis, MN 55422
(612) 987-8808
Monday - Friday: 9am - 6pm.

Blog

Local Drupal 8 development with PHP OPCache & without MAMP or XAMPP

Recently I’ve been contracted to develop a client site with Drupal 8. One thing I have found is the recommended ways to install Drupal are to use “one-click installers” from your web host or use tools like MAMP or XAMPP for local development.

But, what if you’re a minimalist like me and want to use the LAMP stack natively in OSX without those tools? Well, you can do it but there is an issue that I found while attempting to install Drupal 8 without these tools.

That roadblock was Zend OPCache.

I won’t go into all of the specifics of what OPcache is or does but suffice it to say, Drupal 8 Highly Recommends that you have it running in your PHP configuration.

After reading a bunch online, the solution seemed simple. Just edit your php.ini file and change the value from 0 to 1.

[opcache]
;Determines if Zend OPCache is enabled
opcache.enable=1

This seems easy enough. I opened a terminal, edited and saved the file. I restart Apache and refresh my info.php file in the browser. Nothing. No matter what I did, it wouldn’t work.

After trying a bunch of things, I noticed the date and timezone were different and I remembered I changed that info in a file called:
99-liip-developer.ini.

After some research, I found this version of PHP contains additional files that override parts of php.ini

If you look at the top of your info.php file and you see php-osx.liip.ch, you will be affected by this issue as well. After more digging I determined in order to enable Zend Opcache on a native PHP install that is using this version, you need to edit this file:

20-extension-opcache.ini. This is the file that loads Opcache extension for your local PHP installation and will allow you to install Drupal 8 without issues or warnings.

I am posting because it took me many hours to figure this out and I am hoping this will save someone else a great deal of time. Thanks for reading

Posted in Drupal, PHP, Web Development. Bookmark post.