What is the difference between STDOUT, php: stdout, and php: output in cgi of php? Hello everyone:
When I was a beginner in php, I encountered a problem. my current server system is linux, where I run apache cgi to execute user requests.
Suppose I create a php test file test. php, in which fwrite (STDOUT, "this is a test ");
I run this test program in the address bar of the IE browser and cannot get the normal output. However, I run it directly under the linux shell on the server.
This test. php shows the output.
I modified test. php as follows: $ out = fopen ("php: // stdout", 'w'); fwrite ($ out, "this is a test ");
The problem is still above. the ie browser cannot browse the content normally, but the output can be seen normally in shell.
I modified test. php as follows: $ out = fopen ("php: // output", 'w'); fwrite ($ out, "this is a test ");
This time, the ie browser can see the normal output, and the shell can also see the normal output.
I tried to modify test. php again as follows: echo ("this is a test ");
This time, ie is normal and shell is normal.
My problem is, what are the differences between STDOUT, php: // stdout, php: // output, and why apart from php: // output
In addition, apache cannot redirect the program standard output to the correct cgi?
Reply to discussion (solution)
STDOUT is a dedicated constant in CLI mode, which is equivalent to fopen ('php: // stdout', 'w ');
That is, the CLI is valid.
Php: // out is equivalent to echo/print
For details, see "php: //" and "PHP command line mode" in the manual.
It may be that apache has disabled stdout, refer to solve the php-fpm php: // stdout command line printing failure problem-http://blog.csdn.net/zhangrui_fslib_org/article/details/49681563
It may be that apache has disabled stdout, refer to solve the php-fpm php: // stdout command line printing failure problem-http://blog.csdn.net/zhangrui_fslib_org/article/details/49681563