RE: [PECL-DEV] Static array & PHP CLI
| From: | Laupretre François | Date: | Tue, 26 Jun 2012 15:15:51 +0000 |
| Subject: | RE: [PECL-DEV] Static array & PHP CLI | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-9547@lists.php.net to get a copy of this message | ||
if you use such an architecture, everything is done as only one PHP 'request'. The PHP
'request' just lasts one week ! So, PHP persistence is useless in your case, as
persistence is used to persist data between several PHP requests.
The PHP process get requests one by time, like for PHP-CGI.
At the end a the request, the process is not killed, It's just waiting for another request, so
persistence is usefull here.
Yes, I understand that you keep your PHP process alive to handle subsequent requests. But, for PHP,
the whole process, from the time it is created to the time it dies, is considered as a single
'request' (containing your 'request' loop). In such a process, any memory you
allocate using emalloc() functions will actually persist for the whole process lifetime. So, in your
architecture, you don't need to care about allocating PHP persistent arrays, as even arrays
created using array_init() ARE persistent.