CLI - php shell script worked under php4, breaks under php5

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

 



A while back I wrote a little read-eval-print loop that essentially constituted a very basic php shell:

http://weston.canncentral.org/misc/phpsh.txt

This has almost always run fine for me with the cgi versions of php 4, and often proves to be a great help in quickly testing various snippets of code. 

However, I just recently tried to use this with PHP 5.1.2, and found that it doesn't work. Specifically, it seems to wait for input to be typed without issuing a prompt. Upon entering a line, there's no response, until one presses ctrl-d. At this point, it throws a parse error:

	syntax error, unexpected ')' in phpsh5(23): eval()'d code on line 1

regardless of whether or not there are in fact any unmatched parenths (or any parenths at all) on the entered line. And it apparently doesn't execute any of the code at all until one enters "exit" as a command.

I've tried switching from /dev/stdin to php://stdin, tried adding -f or -a to the processing options.... nothing seems to make a difference. I also tried removing my "_readln()" function, and simple entering a default expression. This produces the expected (if repetetive and ultimately practically useless) results, so I assume it's something in my _readln() function that throws it off. 

Any ideas how to get this to work with PHP 5?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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