Using bash shell from within PHP
- by Dan
Hi everyone,
In my terminal window (using Max OS X) my shell is bash. However when I run a command in PHP via shell_exec or backtick operators I see that PHP is using the Bourne Shell (sh). Here's an example of what I'm seeing:
From within my terminal window:
$ echo $0
- bash
Also if I call php as follows:
$ php -r "echo shell_exec('echo $0');"
-bash
However, if I create a script called test.php with the following:
<?php echo shell_exec('echo $0'); ?>
And then run test php I get the following:
$ php test.php
sh
I'm wanting to use the bash shell when calling shell_exec - why is it choosing the Bourne shell and can I force it to use bash?
Thanks!
Dan