Done!

How to fix sudo: no tty present and no askpass program specified error?


Once you comment out #Defaults requiretty on /etc/sudoers you get this error. The fix is easy thought.

Allow user to use the command without prompting for password in /etc/sudoers file, as shown below:

-> sudo vim /etc/sudoers 

#Depending on the user add at the bottom of the file: 

# Apache can check lsof as root for cron_localbatch.php
apache  ALL=NOPASSWD:/usr/sbin/lsof

# used for deployment 
sam ALL=NOPASSWD:/bin/cp
sam ALL=NOPASSWD:/bin/chmod
sam ALL=NOPASSWD:/bin/chown

-> wq!