Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between php-cli and php-fpm mode in regard to APC/APCu

Tags:

php

apc

The thought start from this question under php-cli mode:

PHP apc/apcu cache do not keep intermediate result while shmop do, why?

In this case, APC/APCu do not cache the intermediate result.

However, APC/APCu do cache the intermediate result just as the shmop when under php-fpm mode. So, what's the difference between php-cli and php-fpm when in regards to APC/APCu?

like image 673
lulyon Avatar asked Dec 11 '22 16:12

lulyon


1 Answers

php-fpm ist running in its own process all the time. It can use apc because it uses continuously the ram over several requests. The memory is only released through the garbage collector or if you kill the fpm process. But the a CLI process lives only for one command and when its finished the memory is released. So apc cannot store any data over severel cli calls because it allocates new memory in the ram each call.

like image 137
Crofly Avatar answered Feb 22 '23 23:02

Crofly