跳到主要内容

Using an opcode cache (OPCache, APC or WinCache) - 知识库 / Deskpro Legacy - Deskpro Support

WARNING: You're browsing documentation for an older version of Deskpro. Consider upgrading to Deskpro Horizon

Using an opcode cache (OPCache, APC or WinCache)

作者列表

Deskpro is a large PHP application with hundreds of thousands of lines of PHP code in hundreds of source files. To drastically improve performance, we highly recommend using an opcode cache (also known as a bytecode cache) such as APC or WinCache. An opcode cache stores precompiled versions of scripts in memory, removing the need for PHP to load and parse scripts on every request.

 

OPCache (PHP 5.5 or above)

PHP 5.5 or higher comes with a bundled opcode cache (OPCache). If possible, we recommend you use PHP 5.5 - this removes the need to install the opcode cache separately.

If you have PHP 5.5, DO NOT install WinCache or APC as they are not required.

If you have 5.5 or above but the installation wizard prompts you to install OPCache, you may need to add these lines to your php.ini to enable it:

opcache.enable=1

and

zend_extension=/full/path/to/opcache.so

 or on Windows:

zend_extension=php_opcache.dll

In some cases you may need to specify the full path to php_opcache.dll, e.g.:

C:\Program Files (x86)\PHP\v5.5\ext\php_opcache.dll

 

There are other OPCache settings in php.ini used to tune performance. We suggest starting with the following settings for most systems:

opcache.memory_consumption=128

If you have a server with lots of RAM (8 GB or more), try increasing opcache.memory_consumption to 256. 

opcache.interned_strings_buffer=8opcache.max_accelerated_files=4000opcache.revalidate_freq=60opcache.fast_shutdown=1opcache.enable_cli=0

 

See http://php.net/manual/en/opcache.installation.php for more information on OPCache settings. 

Restart your webserver after editing php.ini to apply changes.

 


 

ONLY if you can't upgrade your PHP version to 5.5, install a separate opcode cache from the ones below.

 

WinCache on Windows

If you are using IIS on Windows you can install WinCache from Microsoft's IIS website at http://www.iis.net/downloads/microsoft/wincache-extension

 

Installing APC on Linux with PECL

You can compile and install APC manually via PECL.

pecl install apc

For more information refer to the PHP manual and the APC PECL page:

 

Installing APC on Debian or Ubuntu

sudo apt-get install php5-dev
sudo pecl install apc
sudo /etc/init.d/apache2 restart

 

Installing APC using yum on RedHat or CentOS

If you have installed PHP using yum, you can activate APC using yum as well:

yum install php-pear php-devel
pecl install apc
service httpd restart

有帮助 没有帮助

109 人中 62 人认为这个页面有帮助

Comments (2)

Jason Voice
What OPcache settings should be used on a DeskPro server?
Ben Henley
Hi Jason, we'd suggest using the "Recommended php.ini settings" at http://php.net/manual/en/opcache.installation.php. If you have a lot of memory (8 GB or more), you may wish to increase opcache.memory_consumption to 256.

添加一条评论

请登录或注册以提交评论。

是否需要密码提醒?