How to install PHP Opcache on MacOS High Sierra?
For me it worked by these steps:
- Search
extension_dir
in "phpinfo()" page, I got a path/usr/lib/php/extensions/no-debug-non-zts-20160303
- By execute
ls -lh /usr/lib/php/extensions/no-debug-non-zts-20160303
, I found "opcache.so" , I guess it's installed when upgraded to "High Sierra" - Create "/etc/php.ini" (by copy "/etc/php.ini.default"), and modify:
[opcache]zend_extension = opcache.soopcache.enable = 1
- Restart apache, module "opcache" is enabled
EDIT / CONCLUSION
Since "opcache extension" is installed on Mac OS High Sierra by default, the solution of enabling opcahe on Mac OS High Sierra is:
- Create "/etc/php.ini" if you don't have one, by simply copy the default configuration:
sudo cp /etc/php.ini.default /etc/php.ini
- Add
zend_extension = opcache.so
to/etc/php.ini
and set "opcache" enable:
php.ini opcache section looks like:
[opcache]zend_extension = opcache.soopcache.enable = 1