PHP5 > passthru() > Redirecting output to a file?

Posted on 2007-10-09
Medium Priority
Last Modified: 2012-06-27
At the link below, the PHP manual says that "Note: If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends."

Could someone post a simple example of how to redict output to a file using the passthru() function?



Question by:Geoff Millikan
  • 2
LVL 43

Expert Comment

ID: 20043738
passthru("the_command with params 2>/dev/null 1>/some/file &");
where 2 means stderr and 1 means stdout

Author Comment

by:Geoff Millikan
ID: 20105718
Sorry, I'm on Windows...  Can you try that example again in Bill Gates jargon...
LVL 43

Accepted Solution

ravenpl earned 2000 total points
ID: 20107041
It works on windows as well. Just omit the 2>/dev/null

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question