I'm trying to create a shortcut script for setting some environment variables and the include path before running php -a. So it looks like this:
#!/usr/bin/env php
<?php
putenv("ENVVAR=value");
passthru("php -a -d include_path=<path>");
This mostly works, but the php shell doesn't correctly output its prompt.
I.e. normal output from php -a:
$ php -a
Interactive shell
php > echo "hi\n";
hi
php >
Output from this script:
$ ./myscript.php
Interactive shell
echo "hi\n";
hi
Additionally, there is no support for walking through the history (or even right or left along what's already been typed) with arrow keys.
Is there a way to get this to work correctly?
I'm using Mac OS X, PHP 5.4.27. I have already tried redirecting stderr to stdout, in case that was somehow the cause (it wasn't.)