I’m using Windows and I would like to set up PHP so as to use bash shell (installed on my machine thanks to msysgit). The reason is that I have Windows on my development machine and Linux on the production machine.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t. But you can launch your own shell like
c:\mingw\bin\sh -c 'set'. That would require Mingw on your machine of course.Using Cygwin it would be:
There is a limit on command line length, therefore I wouldn’t recommend putting the script itself there if it is more than just a one-liner. The options just after the shell script interpreter’s name, are for the interpreter. If you want to pass arguments to the script the interpreter executes, it needs to be inside the quotes, i.e. just after “.exe” in the convert example.
You can pipe a script to the shell script interpreter also. That way, you wouldn’t need to write it to a file, and you could still use a long script.
I.e.:
See http://php.net/manual/en/function.proc-open.php for how to use pipes in PHP.