I am using Boris—"A tiny little, but robust REPL for PHP". To be more specific, I am using WP-CLI's implementation of Boris (wp shell
—it replaces the $boris
command prompt with wp>
).
I was wondering if it was possible to pipe the command line output to say, a text file. For example, I want to capture my PHP info to a text file. Here is what happens when I execute phpinfo();
wp> phpinfo();
phpinfo()
PHP Version => 5.3.14
System => Darwin Macintosh-HD.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
Build Date => Jul 4 2012 17:23:04
Configure Command => './configure' '--with-mysql=/...
//phpinfo() output continues here
I want to redirect this output from the standard display to a text file. I know this is bash syntax, but this is what I want to achieve in theory :
wp> phpinfo(); > phpinfo.txt
// phpinfo.txt now contains phpinfo() output
Is there any way to make this work?
You should be able to use the bash syntax on the command that opens the shell, try it there.
EX:
wp_shell > output.txt
Where "wp_shell" is the command that opens your prompt. You might be able to pass phpinfo directly to the prompt as well if you want to not have to open it, if there is a way to pass direct script to it as with the default php CLI.