Search code examples
phpandroidadb

Executing adb from php


I am trying to run adb from PHP using:

exec( 'adb devices', $output, $return_val );

but I get 126 error.

I think the problem is that php is running as 'www-data' user and does not have permissions to execute adb.

Any solutions?


Solution

  • Check this site out: http://bzed.de/posts/2009/05/howto_set_android_developer_device_permissions_with_udev/

    And add www-data to androiddev. You need to add your specific model to the udev-lines. You can find the vendor- and product-id by connecting your phone to your computer and executing lsusb in a terminal.

    You get something like:

    Bus 001 Device 002: ID 413c:a001 Dell Computer Corp. Hub
    

    where 413c is the Vendor ID and a001 is the ID of the product. Of course, your cell phone should be the line instead of "Dell Computer"...

    Good luck!