Is there a command line php shell available for windows? I looking for something similar to the python shell, that will allow me to open and immediately begin executing code.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
PsySH is the best REPL shell I have seen recently. Tab-completion, phpdoc support, proper namespace handling, interactive debugging, plugin support and many more. It is pure PHP and has composer support so it should be easy to install on Windows. I have only tried it on Linux but looking at the code, it seems to even have some history support on OSes without readline.
Maybe answered - Read here: https://stackoverflow.com/a/19085620/2480481 I think i found easiest way to do it because im so interested to use myself :)
I try all options from here and from some other forums/pages... Windows cannot use readline.
@Pavle Predic 's answer (https://stackoverflow.com/a/15742101/2752670) works for me on Windows.
But I want to use the
shell.php
file anywhere, so my solution is:new and save
shell.php
in php installed dir (or where else you like), e.g.C:\Program Files\php-5.6.12-Win32-VC11-x64\shell.php
new a Windows environment variable, key:
shell.php
, value:"C:\Program Files\php-5.6.12-Win32-VC11-x64"
restart computer
use anywhere in the system:
php %shell.php%
Try this:
Save this code to a file (eg shell.php) and then run it from console:
Hit CTRL+C to exit.
There is the windows command line for PHP: http://php.net/manual/en/install.windows.commandline.php
Have a look at either running php.exe with the
-a
argument, or maybe the phpsh project.