# PHP 6.0 Wishlist [$_PERSISTENT]

- Thread: https://externals.io/message/19693
- Original archive: https://news-web.php.net/php.internals/19693
- Started by Andrey Hristov on 2005-10-22T19:19:53+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #19693 — Andrey Hristov — 2005-10-22T19:19:53+00:00

URL: https://externals.io/message/19693#19693

Hi,
DIY, it's not hard. You need a semaphore (*nix) and shared memory . Semaphores
are not available on Windows but they are emulatable with ext/shmop.
More info can be found here :
http://hristov.com/andrey/projects/php_stuff/pres/writing_parallel_apps_with_PHP.pdf
sources :
http://hristov.com/andrey/projects/php_stuff/shm.php.gz

Use class Shm_Protected_Var (works on *nix only but the sources are easibly
patchable to work on windows with ext/shmop).

Cheers,
Andrey

Andreas Korthaus wrote:
> Jani Taskinen wrote:
> > […]
>
> > […]
>
>
>
> A super-global like $_PERSISTENT could work like $_SESSION, with a
> similar "framework", but could store data which is NOT user-specific
> like session-data.
>
> So you have a very simple methode to store any variables/objects between
> HTTP-requests. If you use something like APC as backend, you will also
> get a fast methode to store/load variables/objects, which are not
> user-specific, and perhaps expensive to create/load (e.g. from a
> webservice, DB...).
>
> The problem with "several machines serving same web pages" is exactly
> the same you have with $_SESSION today. But the session extension
> provides means to work around this using a DB or memcached as backend.
> This could be copied by something like a "Persistance Framework".
>
> But many other PHP installations will have another problem you don't see
> with $_SESSION today: concurrency. That's because you don't have a
> unique session-ID anymore, so application1 can overwrite variables from
> application2, script1.php can overwrite variables from script1.php and
> on shared hosting setups user1 can overwrite variables from user2.
> That's also a security issue.
>
> So an application-ID has been a good idea, but if you have to define it
> by yourself, chances are that two users choose the same application-ID
> and applications will break. So perhaps you also have to find some other
> values, the users cannot control, to avoid concurrency issues. Perhaps
> make a $_PERSISTENT variable only available for the script which has
> created it (by saving the path too, but if you move/rename..., and not
> very flexible anymore).
>
>
> Best regards
> Andreas
>
>
> PS: I've read the discussion on this list before ;-)
