Failed to find apachectl (Centos6, whm, cpanel)

Hi @chok_dee,

I think the effect of the PATH setting is lost because sudo resets it entirely.

You can see this from

PATH=/whoops /usr/bin/sudo env

where the PATH is in fact reset to a default one, not inherited from your non-root shell.

You might be able to get it to find your apachectl with something like

sudo env PATH=$PATH:/usr/local/apache/bin ./certbot-auto --apache

or by running an interactive shell with sudo -s and then changing your PATH from within that shell before running certbot-auto.

2 Likes