Re: PHP-CLI Debugging Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Davy Durham wrote:
> Hi.. I'm working on converting some CLI (not CGI) bash scripts to php
> and was wondering if there's an equivalent to 'set -x' from bash in php
>
> set -x in bash basically causes the statements to be printed to stderr
> as they are executed.  Does php have something similar?
>
> Thanks,
>  Davy

I'm no expert on set -x, but you can easily have stdout go to a file if
that's what you're after.  You'll probably want to use the output
buffering functions to do this.

http://php.net/manual/en/ref.outcontrol.php

<?php

ob_start();
/** Put all of your PHP code here */
$stdout = ob_get_contents();
ob_end_clean();
file_put_contents('/path/to/file', $stdout);

?>

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux