Now the Raspberry Pi doesn’t come with the opcache as a package. Well, at least I couldn’t find it. So I compiled it, and it was relatively easy and fast!
I did all this as root, I’m 90% sure you need to be, but you could try as the pi user and see what happens. But anyway, log in on the command line and
$ sudo -i to get an interactive superuser prompt.
I’m assuming you have a webserver (nginx or apache) installed and set up using php-fpm.
First install php development tools and git.
$ apt-get install php5-dev git
Now download the source.
$ git clone https://github.com/zendtech/ZendOptimizerPlus.git
$ cd ZendOptimizerPlus
The next command phpizes your downloaded source, it customises a few things to make it work with your install.
$ ./configure --with-php-config=/usr/bin/php-config
$ make -j 2
$ make install
Make a note of the directory it installs into. I’m assuming you’re using the php-fpm way of doing things, but if not, adjust accordingly.
Now get your favourite code editor up and edit:
Pop this into that file:
zend_extension=--the directory you noted down--/opcache.so opcache.memory_consumption=32 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 #set this to 0 if running a development server opcache.fast_shutdown=1 opcache.enable_cli=1
Now restart php.
$ service php5-fpm restart
And you’re done. One php opcache. Speedy!