<?PHP
function readln() { $fp=fopen("/dev/stdin", "r"); $input=fgets($fp, 255); fclose($fp); return rtrim($input); }
print "\n";
foreach($argv as $arg) include_once($arg);
do { print "phpsh> "; $cmdline = readln();
$lastchar = substr($cmdline,-1);
if(($lastchar == ';') || ($lastchar == '}')) // No Return Value
$returnval = eval($cmdline);
else // eval and return the value
$returnval = eval("return($cmdline);");
if(isset($returnval) && !empty($returnval)) { echo $returnval,"\n"; } } while(TRUE); ?>
Since it lets you evaluate setup test scripts specified via the command line, it's not a half-bad way to debug things, not to mention ints main purpose, which is to let you interact with the language or some other code and see if things behave as you expect.
It runs great on my home system, running OS X, and one other web server I host on However, I recently moved it over to a friend's shared hosting at Verio, and it doesn't run on this system. Rather, it gives me the following messsage:
<b>Parse error</b>: parse error in <b>/usr/home/jakus1/www/htdocs/phpsh(28) : eval()'d code</b> on line <b>1</b><br />
phpsh> <br />
<b>Parse error</b>: parse error in <b>/usr/home/jakus1/www/htdocs/phpsh(28) : eval()'d code</b> on line <b>1</b><br />
Which it actually repeats over and over again, until I hit ^C or ^Z. Looks to me like my function to get command line entries isn't working so well -- but why not on this server if it works so whel on the other systems? Is there a setup option I'm missing?
And while we're at it, has anyone written a tool that will tell you what's different between server setups?
Thanks, Weston
~ == ~ http://weston.canncentral.org/ Correct as usual, King Friday
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php