I have 2 short scripts. The first, an awk script, processes a large file and prints to a named pipe 'myfifo.dat'. The second, a Perl script, runs a LOAD DATA LOCAL INFILE 'myfifo.dat'...
command. Both of these scripts work when run locally like so:
lee.awk big.file &
lee.pl
However, when I call these scripts from a PHP webpage, the named pipe blocks:
$awk="/path/to/lee.awk {$_FILES['uploadfile']['tmp_name']} &";
$sql="/path/to/lee.pl";
if(!exec($awk,$return,$err)) throw new ZException(print_r($err,true)); //blocks here
if(!exec($sql,$return,$err)) throw new ZException(print_r($err,true));
If I modify the awk and Perl scripts so that they write and read to a normal file, everything works fine from PHP. The permissions on the fifo and the normal file are 666 (for testing purposes). These operations run much more quickly through a named pipe, so I'd prefer to use one. Any ideas how to unblock it?
ps. In case you're wondering why I'm going to all this aggravation, see this SO question.