Re: Shared Memory Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

There is a strange problem now. This is the error message my php file gives.
"kernel not configured for shared memory kernel not configured for
semaphores kernel not configured for message queues"

The source is as follows:
<?php

$shm_id = shmop_open(5678, "a", 0, 0);
if (!$shm_id) {
   echo "Couldn't create shared memory segment\n : $php_errormsg";
}

print "<br>";
print system("ipcs");

?>

when I logged into my machine as user apache and tried ipcs command it
was working fine (I changed the shell of apache from /sbin/nologin to
/bin/bash)

Any clue??

Regards,
Yaswanth


On 11/16/05, Yaswanth Narvaneni <yaswanth@xxxxxxxxx> wrote:
> Hi Curt,
>
> These are my open shared memories in the server output of ipcs command.
>
> ------ Shared Memory Segments --------
> key        shmid      owner      perms      bytes      nattch     status
> 0x00000000 18645001   gOLeM     600        393216     2          dest
> 0x0000162e 18808842   root      666        30         1
>
> The last one the the sharedmem the php will be using. the key is 5678
> and as you said I
> have modified my code to
>
> $shm_id = shmop_open(intval($shm_key), "a",666,0) or die("FATAL
> ERROR:: $php_errormsg");
>
> U obtain the shm_key from a file. The key I am using is 5678 and it is
> getting that value from the file. I even hardcoded the value, but the
> error is not getting solved.
>
> Is this a proble with any of the server configs? Coz we have
> downloaded an example C file and this is also not working with the
> PHP. Where as if the server and client both written in C are able to
> communicate using the shared memory. Any clue any one??
>
> Ok...just a crazy query...does it have anything to do with
> Notice: import_request_variables(): No prefix specified - possible
> security hazard in
>
> which occurs due to register_globals set to Off??
>
> On 11/16/05, Curt Zirzow <czirzow@xxxxxxxxx> wrote:
> > On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote:
> > > Hi!
> > >
> > > I have a server written in C++ and my webpages are in PHP. The PHP has
> > > to communicate with the server using shared memory. This was working
> > > fine on the server running FC-1 with php-4.3.8. We recently migrated
> > > to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it
> > > displays is as follows:
> > >
> > > shmop_open(): unable to attach or create shared memory segment in
> > > /var/www/html/sharedmem.php on line 2
> > >
> > > The server opens the shm in 666 (originally was 644) even then it was
> > > not working. I can see the shared mem open using 'ipcs' command.
> > >
> > > ...
> > > $shm_id = shmop_open($shm_key, "a",0,0) or die("FATAL ERROR:: Unable
> > > to Access Shared Memory");
> >
> > You might want to try to open it within the same mode that the
> > server created it in:
> >
> > 1)
> >   $shm_id = shmop_open($shm_key, "a",0666,0);
> >
> > 2)
> >   are you 100% sure the key is valid? the error message you are
> >   getting seems to point in this direction since the shmop_open is
> >   failing on the C call to shmget(), wich usually fails when either
> >   you dont have enough memory to create it (which you arn't doing),
> >   some other creation problems, or that the key supplied wasn't
> >   found.
> >
> >
> > Curt.
> > --
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> "In theory there is no difference between theory and practice.
> In practice there is." -- Fortune Cookie
>


--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux