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

Posted on 2007-10-09
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
    LVL 43

    Expert Comment

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

    Author Comment

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

    Accepted Solution

    It works on windows as well. Just omit the 2>/dev/null

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Where is this Code Igniter page going? 4 25
    Generating Excel in php 5 31
    duplicate data not insert in mysql 46 33
    Mysqli Query 5 20
    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…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now