title: PHP : Impossible to exec() under Android
body: <p>I'm willing to develop a small webapp on my android (rooted, 4.2.2) smartphone. The app is designed in PHP to run on a local network.
  To do so, i installed KickWeb Server app on the phone from the Play Store. PHP works well yet I'm unable to use any of the functions related to exec (system, passthru, shell_exec).</p>
  
  <p>Apparently, it is a reccurent problem when programming on Android platform due to unusual location of the shell. (/system/bin/sh instead of traditionnal /bin/sh).</p>
  
  <p>Someone had the same problem <a href="https://stackoverflow.com/questions/14487637/none-of-the-exec-related-php-functions-work-under-android">here</a> so I checked php.ini : safe mode is off and there are no deactivated functions.
  Then I tried the suggested workaround by symlinking /system/bin/sh to /bin/sh and trying to fix ownership/permissions, i still got nothing...
  Here's my PHP test file :</p>
  
  <pre><code>  &lt;?php echo "hello world";
    $out = system('date');
    echo $out; ?&gt;
  </code></pre>
  
  <p>It results in hello world and nothing else, no error.
  I'm sure I must have missed somthing yet I can't figure out what. I'm not that familiar with developping under Android.
  I hope you guys have a clue, thanks.</p>
  
  <p>Edit : After rebooting the phone, I noticed the /bin folder and /bin/sh symlink had been removed... I don't understand. Here are the steps I followed to create them :</p>
  
  <pre><code>mount -o rw,remount,rw /
  mkdir /bin
  ln -s /system/bin/sh /bin/sh
  chmod 777 /bin/sh
  chown shell /bin/sh
  </code></pre>
  
  <p>I also tried copying whole /system/bin directory to /bin, doesn't work better.</p>
  
  <p>Maybe I should've posted in Android enthusiast community. I'm not quite sure though, sorry for the mess.</p>