A
A
agsidorov2013-12-13 14:09:55
PHP
agsidorov, 2013-12-13 14:09:55

Why doesn't php://stdin work in nginx?

$stdin = fopen('php://stdin', 'r');
$line = trim(fgets($stdin));
var_dump($line);

Doesn't work under nginx. How to be?)
file_get_contents('php://input') behaves in the same way Let me
clarify the question. There is a lib for asterisk - phpagi . Actually, she does not want to start under nginx, hangs on fgets

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2013-12-13
@miraage

Wait. stdin is the input stream. As far as I know, only console PHP has such an implementation.
Perhaps you meant file_get_contents('php://input') - or did I misunderstand?

E
egor_nullptr, 2013-12-13
@egor_nullptr

php://stdin - standard input stream, when working with nginx (php-fpm or cgi) nothing can be read from it.
php://input - POST data can be read from this stream
Judging by the description of the specified library, it works only through the CLI.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question