go to bug id or search bugs for
I've managed to cross-compile PHP 5.3.8 for ARM platforms (to be run on rooted Android phones).
The trouble is that when you execute a system('pwd'), the command doesn't print any output (and it doesn't execute pwd).
A strace indicates that PHP tries to execute /bin/sh -c pwd in fact.
However, on Android phones, /bin/sh doesn't exist (like in Linux distros), but in fact the path is /system/bin/sh.
Mounting / as read-write and creating /bin/sh to point to /system/bin/sh is more difficult than allowing a configuration key/value pair to point to the executable itself.
Or use the SHELL environment variables ?
It should not be hardcoded (I found this only using strace - there's no error message in case the command fails because /bin/sh is not found) - or at least, it should use the SHELL environment variable in case /bin/sh doesn't exist).
I expect system('pwd') to work.
Add a Patch
Add a Pull Request
After further investigation, it seems that the proc_open.c code is not actually called in case of system(...) / exec(...).
PHP apparently delegates to libc::system(...) call to do the PHP system / exec calls. However, libc standard is to assume /bin/sh as shell - and thus, it has it hardcoded.
I have changed the sourcecode of uClibc to use /system/bin/sh, statically linked PHP against it, and not it works.
I guess this bug can be closed - but I'd like to know what proc_open.c does in fact (since /bin/sh is hardcoded there too).
Thanks for checking it.