php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #27271 shmop doesn't work.
Submitted: 2004-02-16 03:42 UTC Modified: 2004-02-17 12:21 UTC
From: yury at gorodok dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.0b4 (beta4) OS: win32 only
Private report: No CVE-ID: None
 [2004-02-16 03:42 UTC] yury at gorodok dot net
Description:
------------
shmop doesn't work properly.
I start sh.php, which creates shmop segment and write a strring there.
After that I start hh.php, which should read string and write it in my browser.
The hs.php deletes segment.

On FreeBSD with PHP 4.3.4(apache module and command line) this works just fine.
But on Win2000SP2 with PHP5.0.0b4(commandline and cgi) I can access
shared memory segment only while the first script is running (I' ve adde sleep(30) in it for test reasons).


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-16 11:23 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2004-02-16 23:13 UTC] yury at gorodok dot net
sh.php
<?php $shm_key= 111; $str="I was here."; $shm_id= shmop_open($shm_key, "c", 0644, strlen($str));
 if ($shm_id== false) echo "I was unable to create shmop!<BR>";
 else { $wrb=shmop_write($shm_id,$str, 0); 
        if($wrb!= strlen($str)) echo $wrb." bytes was written of ".strlen($str)."!<BR>";
        echo "shm_id=".$shm_id."<BR>";  shmop_close($shm_id);} ?>

hh.php
<?php $shm_key= 111; $shm_id=@shmop_open($shm_key, "a", 0, 0);
 if ($shm_id== false) echo "Couln'd open shm <".$shm_key.">!<BR>";
 else {$A=shmop_read($shm_id, 0, shmop_size($shm_id)); echo $A."<BR>";
       echo "shm_id=".$shm_id; shmop_close($shm_id); } ?>

hs.php
<?php $shm_key= 111; $shm_id=@shmop_open($shm_key, "a", 0, 0);
 if ($shm_id== false) echo "Couln'd open shm <".$shm_key.">!<BR>";
 else {$A=shmop_read($shm_id, 0, shmop_size($shm_id)); echo $A."<BR>";
        echo "shm_id=".$shm_id;  shmop_delete($shm_id);  shmop_close($shm_id); } ?>
 [2004-02-17 10:48 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

SHM is emulated on win32 and the nature of the emulation 
that it would work only in a persistent environment such as 
Apache or IIS (not cgi or cli). 
 [2004-02-17 11:26 UTC] yury at gorodok dot net
http://us2.php.net/manual/en/ref.shmop.php says:
<<Note that versions of Windows previous to Windows 2000 do not support shared memory.>>
I use Windows 2000. It's not <previous> and I've not found anything about emulation nor current enviroment.
Sorry, that I don't know Windows enough to undestand that shmop CANN'T work on it properly.
May be, there should be a note in manual?
 [2004-02-17 12:21 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

As Ilia said, Shmop won't work when PHP is in CLI or CGI mode.
 [2020-02-07 06:12 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=f160397e55f180fa16d93b5b0369b873b936967e
Log: fix #27271 dont work in CLI or CGI under windows
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 01:01:28 2024 UTC