Re: [PHP] shared memory access - shmod_open



Richard Lynch wrote:
On Thu, December 6, 2007 2:44 am, Rolf_ wrote:
I have a problem working with shmop_open() in a Solaris environment.
The
following cli-script works fine, except shmod_open returns a warning
'unable
to attach or create shared memory segment':

<?php
$sem = "/tmp/" . rand() . ".sem";
touch ($sem);
echo "sem $sem \n";

$sem_key = ftok($sem, 'w');
echo "sem_key $sem_key \n";

if ($sem_key == -1) { die ("ftok error"); }

$shm_id = shmop_open($sem_key, "w", 0644, 1);
echo "shm_id $shm_id\n";
?>

I checked the $sem_key with the Solaris ipcs command. The file exists
and
the read/write rights are correct. I tried explictly to call
shmop_open with
the right key - the error message remains the same.

Checking out different access mode like "r" does not succeed too. In
the
Xdebug output, php changes the value 0644 to 420, i.e.
shmop_open(1258300033, 'w', 420, 1). Of course, I compiled php with
--enable-shmop.

Does anyone has an idea what I might also check?

Perhaps the 0644 needs to be expressed in some other way?

I know it works fine that way for chmod and friends, so I wouldn't
expect it, but...

Or maybe 420 *IS* the right value, and you're on a red herring.

Try Googling for the error message and Solaris if you haven't done
that yet.


The problem is that 0644 == 420, because 0644 is parsed as "644 base 8" (the
zero prefix forces the number to octal...)
So 420 (decimal) is actually the correct value. RTFM for chmod, which gives you
a big hint about this...
.



Relevant Pages

  • Re: [PHP] shared memory access - shmod_open
    ... echo "sem $sem \n"; ... I checked the $sem_key with the Solaris ipcs command. ... Xdebug output, php changes the value 0644 to 420, i.e. ... Try Googling for the error message and Solaris if you haven't done ...
    (php.general)
  • [PHP] shared memory access - shmod_open
    ... I have a problem working with shmop_openin a Solaris environment. ... echo "sem $sem \n"; ... the right key - the error message remains the same. ... Xdebug output, php changes the value 0644 to 420, i.e. ...
    (php.general)
  • Re: [PHP] shared memory access - shmod_open
    ... I tried the php function chmodwhich works fine even if it ... cf. xdebug trace file: ... I know it works fine that way for chmod and friends, ... Try Googling for the error message and Solaris if you haven't done ...
    (php.general)
  • Re: Includin files in the parent directory
    ... When I try to run this code on a Linux server, ... following error message: ... try chmod 555 parent_dir ...
    (comp.lang.php)
  • Re: PHP chmod Newbie Question
    ... How does the server keep ... how do I create user groups for chmod to recognize? ... CHMOD is for UNIX based servers, and the PHP chmod() ... edited or removed by the PHP script, and only read by the UNIX ...
    (comp.lang.php)