How to determine if PHP OPcache is enabled or not?

后端 未结 2 798
粉色の甜心
粉色の甜心 2021-02-01 02:07

I am trying to enable opCache on my server (ubuntu 12.04 LTS, running apache 2.4.7 with PHP Version 5.5.10-1+deb.sury.org~precise+1).

2条回答
  •  耶瑟儿~
    2021-02-01 03:07

    Have faith in your phpinfo(), you've got the necessary shared module running or it wouldn't be showing up.

    Also, your opcache is indeed enabled, but only for web, not cli. The default for the library is enabled for web so , to disable uncomment the line starting with a semicolon like this:

     opcache.enable=0 
    

    As noted, for command line php use, the default is disabled, to enable it, uncomment and set to 1

     opcache.enable_cli=1
    

    Here is a list of all runtime arguments and there default value for further reference: http://www.php.net/manual/en/opcache.configuration.php

    UPDATE: As of 2020, this library may be no longer maintained, see comments below for other possible options.

    If you want a cool web monitor page for it (like apc.php does for apc) try this: https://github.com/rlerdorf/opcache-status

提交回复
热议问题