Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Allow the www-data user to run to run adb and abd with no password:

sudo visudo

Add to the contents of the sudoers file:

User_Alias WWW_USER = www-data
Cmnd_Alias WWW_COMMANDS = /sbin/adb, /sbin/abd
WWW_USER ALL = (ALL) NOPASSWD: WWW_COMMANDS

Save.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.