• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Zend Opcache & FastCGI


Well-known member
Since switching to fCGI instead of Apache handler to make things easier with permissions, Zend Opcache is caching things differently.
When using Apache handler, the cached scripts would continue to increase and so would cache hits (this could reach hundreds of millions).
Using fCGI, cached scripts seem to reset and cache hits also drop to 0 and increases again. You can see here,

Refreshing 2 minutes later,

Is this intended behaviour?
Thank you.


Well-known member
@Solidus have a look ta the number of restarts. It is by design that the cache recycles itself if it gets too full.

You can try increasing how many slots the opcache has, or memory being used.

Give Memcache a try. I like it far better then Opcache using FastCGI
Going by the monitoring tool, he is only using it for opcode caching. Memcache can't be used for that (it caches variable data)


Well-known member
I use memcached with opcache.
The cache doesn't even get close to full, barely 5% of the 1.5gb allocated to it is used when the cache resets.


Active member
This may seem a little extreme and not a direct solution, but have you considered apache 2.4 and fastcgi php-fpm?

Gene Steinberg

Well-known member
This may be a dead thread, but i wanted to resurrect it. I am trying PHP-FPM on a Plesk server. It does work very well with Opcache, but we have a problem that prevents its use.

Our webmaster set up a small set of PHP code that works with our premium podcast service, which is configured as a member upgrade in XenForo using Resource Manager. Well, the PHP code provides a special authenticated RSS feed. But when I switch from FastCGI to PHP-FPM, it breaks the login sequence. I keep getting the login prompt.

Anyone who can help me fix this PHP code can contact me privately and I'll send the code.

Gene Steinberg

Well-known member

I had to change our PHP code and add a special Apache header to make this work with PHP-FPM. Plesk 12.5.x offers FastCGI w/Apache, PHP-FPM w/Apache, and PHP-FPM with nginx.

The one in the middle, when I got it properly configured with the help of a friendly support rep from Parallels on his own time, produces noticeably spiffier performance on all my sites because it works more efficiently with Zend Opcache. With FastCGI, the cached content is constantly dumped, so performance isn't as good.


Active member
"Plesk 12.5.x offers FastCGI w/Apache, PHP-FPM w/Apache, and PHP-FPM with nginx."
FastCGI isn't a PHP processor, it's a protocol to transmit requests. That's like saying that you generated a html page using HTTP. It doesn't make sense.

FastCGI can't process PHP code. It's not a PHP processor. It's a protocol used to pass requests to language processors, which in the case of PHP, would be PHP-FPM.

Nginx nor Apache can use php-fpm on its own, it uses a fastcgi module to make requests to php-fpm.

location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

Here is an example of fastCGI php-fpm being implemented in nginx.
Notice it uses both fastcgi and php-fpm. That's because it's using fastcgi to pass the call to php-fpm.