note 110903 added to function.shm-put-var
| From: | JasonLester | Date: | Fri, 21 Dec 2012 09:28:31 +0000 |
| Subject: | note 110903 added to function.shm-put-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192627@lists.php.net to get a copy of this message | ||
Yes, it is possible to maintain a real level of resource persistence using shared memory. All vars
in PHP are stored in common hashtables as zvals, including resource identifiers. There are
hashtables available that outlive the request as long as the entire PHP process isn't shut
down. All you need is to store the identifiers in such a hashtable and a way to keep track of them
and you can receive the original resource.
I don't know why PHP doesn't provide a way of setting/getting persistent resources, but it
is likely do to the many types of SAPI's available for it and the fact that not all of them
*can* facilitate this, including CGI which still if far from obsolete.
Another problem is that having such access in userspace is bound to create issues where multiple php
processes are trying to access the same resource. Looking at it from this angel you can see that
there's really no safe way to safely use such getter/setters without a better synchronism
scheme in PHP.
----
Server IP: 69.147.83.199
Probable Submitter: 75.196.113.242
----
Manual Page -- http://php.net/manual/en/function.shm-put-var.php
Edit -- https://master.php.net/note/edit/110903
Del: integrated -- https://master.php.net/note/delete/110903/integrated
Del: useless -- https://master.php.net/note/delete/110903/useless
Del: bad code -- https://master.php.net/note/delete/110903/bad+code
Del: spam -- https://master.php.net/note/delete/110903/spam
Del: non-english -- https://master.php.net/note/delete/110903/non-english
Del: in docs -- https://master.php.net/note/delete/110903/in+docs
Del: other reasons-- https://master.php.net/note/delete/110903
Reject -- https://master.php.net/note/reject/110903
Search -- https://master.php.net/manage/user-notes.php