Categories
WordPress

Enabled Opcache.

同一記事の日本語版

   On Dec. 24th, I enabled Opcache on my server (Windows7HP + SP1 (x86)).

   Since installing “BulletProof Security“, it gave me a few trouble. On the other hand, it also brought me some useful information about PHP. For example, I saw its System Information page and changed values in my php.ini like the below. It’s for the security reason.

Default Custom
output_buffering = 4096 output_buffering = Off
expose_php = On expose_php = Off
mysql.allow_persistent = On mysql.allow_persistent = Off

   The other day, I found the words “Opcode Cache” on the page. It reminded me of OPcache bundled with PHP5.5. Then I tried to enable it on my server.

   I changed some settings in my php.ini.

   First, I added the line “zend_extension=php_opcache.dll” to the end of Windows Extensions and changed the next six lines by following this page instructions. I can find better values for my server someday, but now, to follow the page instructions is better for me who is a very newbie of Opcache.

Default Custom
;opcache.enable=0 opcache.enable=1
;opcache.memory_consumption=64 opcache.memory_consumption=128
;opcache.interned_strings_buffer=4 opcache.interned_strings_buffer=8
;opcache.max_accelerated_files=2000 opcache.max_accelerated_files=4000
;opcache.revalidate_freq=2 opcache.revalidate_freq=60
;opcache.fast_shutdown=0 opcache.fast_shutdown=1
Details
Details
Files
Files

   I don’t use the CLI version of PHP, so I left “;opcache.enable_cli=0”.

   On Apache benchmarks of before and after. ApacheBench
   This benches show some improvements. But, with my feelings I realized more than the benches on the home network. I think Opcache brought major effects to my sites because most of them depend on PHP scripts, i.e. WordPress.

   I had heard about APC Control Panel, so I looked for a Control Panel of Opcache and found. You can control Opcache from a Web browser by Opcache Control Panel, ocp.php. It requires the php function ‘phpinfo’, so you had better make an access control for this file.

Leave a Reply

Your email address will not be published. Required fields are marked *