Fread cannot read the popen value, but runs normally in the command line. fread cannot read the popen value.
$output = '';$pipe = popen($somecommand, 'r');while(!feof($pipe)){ $output .= fread($pipe, 1024);}
Execute $ somecommand in the command line to display the code normally, but the value cannot be obtained when the above code can be run.
Reply to discussion (solution)
You need to confirm:
1. $ somecommand is a process rather than a thread
2. $ somecommand is written to the standard output.
This type of application can be used in the Test environment. If this type of function is disabled in the official environment for security reasons, isn't it enough?
You need to confirm:
1. $ somecommand is a process rather than a thread
2. $ somecommand is written to the standard output.
This type of application can be used in the Test environment. If this type of function is disabled in the official environment for security reasons, isn't it enough?
I haven't come to CSDN for a long time. I am nagging the moderator to answer this question myself. thank you first. I have also considered the problem of security and efficiency and want to switch to socket for calling. I would like to ask again: in PHP, if there is any better solution for similar applications, so as to get the call value? Thank you.
$output = '';$pipe = popen($somecommand, 'r');while(!feof($pipe)){ $output .= fread($pipe, 1024);}
Execute $ somecommand in the command line to display the code normally, but the value cannot be obtained when the above code can be run.
You command to add this "2> & 1", I see here: http://blog.csdn.net/kangear/article/details/9141481
The command I used is dd, which is the same as your problem. it is okay to add that.