STDIN, STDOUT and STDERR are three special files that are associated with the terminal (on Windows - with the console) in console applications.
The STDIN file (standard input) by default is "connected" with the keyboard - everything you type on the keyboard gets there.
The STDOUT (standard output) file is by default “linked” to the monitor — you will see everything that you write into it on the screen.
The STDERR file (standard error output) is a copy of STDOUT. Used to display error messages. This separation is made to be fashionable to redirect them separately. So, the command line pipes (pipelines) do not touch STDERR - therefore the normal output goes further along the pipeline, and errors are displayed immediately on the screen.
The word "connected" above I took in quotes, because in fact there is no direct connection. Formally, all three files by default are associated with the same terminal, and already the terminal somehow processes the keystrokes of the keyboard and displays the inscriptions on the screen.
Closing these files in Linux is part of the so-called demonization procedure (going into the background), this is done so that the process can no longer be considered as running on this terminal.
In multithreaded programs, these files are often closed in order to open new ones "in their place". In other words, this is a way for a program to redirect I / O streams to itself. See the example below - there must be something else done with these files.
Now why haven't you got an example? There are two reasons, and both are in the word "Denver."
First, as I said, these files are a sign of a console script, not a web page. The script does not need to run through Denver, it must be run from the console:
`php путь/к/скрипту.php параметры`
Perhaps you should look for a chapter about running php from the console before you start multithreading.
Secondly, most tricks with these files are specific to Unix-like operating systems. Therefore, you will most likely have to learn to work with Linux.
This can be done in as many as 4 ways:
The most radical option is to simply take and install Ubuntu for yourself. Ubuntu is a fairly popular Linux distribution for desktops. Most web projects are made under Linux (you can say, Linux on the web is the OS by default), so this radical step is justified.
You can raise the virtual machine and put Debian on it. This option is close to what you will encounter when trying to post the result of work on the VDS. Debian is the most stable Linux distribution, well suited for general purpose servers. Especially for training servers.
You can get an analogue of the linux environment by setting yourself cygwin. A good way to understand "what is a terminal in Linux" without installing Linux. Probably the easiest option - because all the files are on the same computer.
If you have Windows 10 x64, you can try Windows Subsystem for Linux . I myself didn’t work with this joint creation of Canonical and Microsoft - so I can’t say how this option differs from the cygwin version.
stdin(standard input),stdout(standard output) andstderr(standard error). Typically, these streams are sent to the console, but in environments that support I / O redirection, they can be redirected by the operating system to another device. - Invision