I have something like this:

$re = shell_exec("sudo /usr/local/share/phantomjs --version");

Unfortunately this gives me another problem:

 sudo: no tty present and no askpass program specified
 Sorry, try again.

User that cron runs under is bokac so Using visudo as root I added line in /etc/sudoers :

  bokac ALL = NOPASSWD: /usr/local/share/phantomjs

I have to mention that /usr/local/share/phantomjs is a sym link to executable under /usr/local/share/phantomjs-master/bin/phantomjs.

Basically, this is not working, I keep getting error message stated above. Is my sudoers line correct? What am I doing or not doing wrong? Any help appreciated.

1 Answer 1


All this was solved by chmod 0777 on executable file that sym link was pointing at, and no need for changing sudoers any more. That made more confusion then help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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