What is the difference between STDOUT, php: // stdout, and php: // output in cgi of php? -Php Tutorial

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.