Edit report at https://bugs.php.net/bug.php?id=60081&edit=1
ID: 60081 Updated by: fel...@php.net Reported by: zburlindibus at gmail dot com Summary: /bin/sh hardcoded in proc_open.c -Status: Open +Status: Not a bug Type: Bug Package: *Configuration Issues Operating System: ARM cross-compile PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: Thanks for checking it. Previous Comments: ------------------------------------------------------------------------ [2011-12-05 21:20:42] zburlindibus at gmail dot com 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). ------------------------------------------------------------------------ [2011-10-17 21:42:06] zburlindibus at gmail dot com Description: ------------ 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). Expected result: ---------------- I expect system('pwd') to work. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60081&edit=1