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... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php