|  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
 [2003-11-16 02:11 UTC] tipton at shsu dot edu
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 -

reader -

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-17 16:35 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

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]
Pipes are read as any other file on unix, using fopen() fread() & friends.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 10:03:35 2021 UTC