[phpa] Re: SHM Permissions

  • From: "Nick Lindridge" <nick@xxxxxxxxxxxxxxxxxxxxx>
  • To: <phpa@xxxxxxxxxxxxx>
  • Date: Wed, 15 May 2002 08:44:10 -0000 ()


> so ... now to the bogo ... I got the nearly the same problem as Marco.
> I installed Version 1.3 of PHPa and everything is fine on running
> default values.
> But by changing
>
> phpa.shm_perms = 644
> phpa.shm_user="httpd"
> phpa.shm_group="httpd"
>
> I noticed that phpa_cache_admin could not even connectd to the shared
> memory.
> The child process is running as httpd but the Apache is started as
> root.

The above looks fine.

> phpa_cache_admin is telling me:
>
> [root]>phpa_cache_admin -m
> 8388608:8374184:32768:32768:8337260:4156:0:1021427005:m
> [root]>su httpd
> [httpd]>phpa_cache_admin -m
> Unable to acquire shm sems - Permission denied
> Unable to access cache shared memory - Permission denied
> No shm cache available with key 0x0c0deb00
> [httpd]>ipcs -m
> ------ Shared Memory Segments --------
> key        shmid owner perms bytes   nattch status
> 0x0c0deb00 12292 root  644   8388608 9
> 0x00000000 12294 httpd 600   92164   9      dest

hmm, that's strange. What happens is that apache/php/phpa first runs as
root, and phpa creates the shm. Then it switches the user/group of the
shared memory. My system at home shows the following:

root@pod:/usr/local/builds/apache-1.3.22/bin > ipcs

------ Shared Memory Segments --------
key       shmid     owner     perms     bytes     nattch    status
0x00280267 0         root      644       1048576   1

0x0c0deb00 110081    nobody    644       8388608   21

0x00000000 109058    nobody    600       46084     21        dest

so you can see ownership of the shm is now nobody. You might try
stopping apache, checking that the shm was removed, and then
restarting. If the shm is still owned by root and not showing as httpd,
then take a look in the apache error log for any messages. Send me a
private email if it's still root.

> In fact, the script could read the shared memory ... so why it tell me
> that there is no such key available ? Isn't it enought for the stats
to
> read the shared mem ... maybe to flush I have to write, but to get the
> status also ?

This isn't quite correct. The message about no shm is misleading, but
what it really means is that it couldn't access both the shm and the
semaphores. The locking mechanism and crash detection mechanism require
that phpa_cache_admin writes to the shm in order to read it, and it
needs to acquire some semaphores.

nick



------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts: