PHP and Shared Memory


So what good are the shared memory functions? well you can use them to share data between different PHP scripts or even with other processes running in your server. Very usefull if you know how to make use it. The trouble is I don't. Shared memory functions are an area that I never looked at before.

After yesterday's fiasco with PHP 5 and Java 5 I decided to investigate turck MMCache a bit further and found references to Shared Memory and semaphores, that set me wondering If I might use it in mega upload to improve it's performance.

In any event I had to recompile my php installation to try to accomodate java 5 with php 4 and in the process I decided to add --enable-sysvshm and --enable-sysvsem to the configure script. Some of the user contributed comments in the PHP manual were really usefull in getting started. Just a short while ago I managed to write hello world using shared memory. Here is what it looks like

shm1.php - saves a variable in shared memory.

comments powered by Disqus