Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php with readline support compiled for windows

Is there any compiled php package with readline support built-in?

readline is required in order to use php in interactive mode.

I looked at how to compile php for windows but they require MS Visual Studio which I don't have.

like image 924
Mert Nuhoglu Avatar asked Mar 22 '12 21:03

Mert Nuhoglu


2 Answers

Readline extension is not available on Windows. I think it is possible to compile PHP under cygwin enabling --with-readline option

like image 117
galymzhan Avatar answered Nov 09 '22 23:11

galymzhan


    //The readline library is not available on Windows.

<?php
       if (PHP_OS == 'WINNT') {
           echo '$ ';
           $line = stream_get_line(STDIN, 1024, PHP_EOL);
        } else {
                 $line = readline('$ ');
               }
 ?>

I found this code straight out of the php documentation. As you may see there is no support for the readline library in windows machines (at least in a ddefault packet) which sucks but you can get something similar by doing the "$line = blah, blah " you see in the code above.

I tried it and made it work using window's standard cmd (althought I think the interactive php mode won't work in windows no matter what) but It's better than not having any user input (if you actually get to remember all that code).

like image 38
Ansr Avatar answered Nov 09 '22 23:11

Ansr