php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26271 Cannot read from pipe created with posix_mkfifo()
Submitted: 2003-11-16 02:11 UTC Modified: 2003-11-19 18:37 UTC
From: tipton at shsu dot edu Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.3 OS: Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tipton at shsu dot edu
New email:
PHP Version: OS:

 

 [2003-11-16 02:11 UTC] tipton at shsu dot edu
Description:
------------
wrote a script to test with following the order: create pipe, open pipe for writing, write to pipe, close pipe.  with another script to open the pipe, read from the pipe, close the pipe, unlink the pipe.

the writer script hangs on the fopen() unless it's mode is 'w+', the reader script hangs on the fopen() regardless of mode.

i accept that it may be something i am doing wrong, but i can find no documentation anywhere dealing with pipes in PHP.

Reproduce code:
---------------
writer - http://piplipton.homelinux.org/socket/test.txt

reader - http://piplipton.homelinux.org/socket/test2.txt

substitute .php for .txt in the above links to run the actual scripts.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-17 16:35 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

You should be using popen() and/or proc_open() to work with pipes.
 [2003-11-17 17:31 UTC] tipton at shsu dot edu
please re-read my description of the problem.

i am not trying to open a "pipe" to a program that was started (i.e. not stdin, stdout, or stderr) which is what one would use popen() or proc_open() for.

what i would like to do is open a pipe (made with posix_mkfifo()) from a master "server" script and have another script run occasionally and use the pipe for IPC (Inter-Process Communication) by writing to it.

maybe the documentation for posix_mkfifo() should have some sample code illustrating how to read/write from/to a fifo, like is shown on the fopen() page dealing with reading regular files.
 [2003-11-19 18:37 UTC] edink@php.net
Pipes are read as any other file on unix, using fopen() fread() & friends.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 22:01:31 2024 UTC