之前一直用的nginx,换了份新工作,发现公司用的apache,安装了memcache扩展需要重启,Debian重启apache提示如下内容:
apache2: bad user name ${APACHE_RUN_USER}
apache启动时,读取/etc/apache2/apache2.conf文件,里边用到了环境变量 APACHE_RUN_USER,APACHE_RUN_USER定义在/etc/apache2/envvars
而不是使用默认的登录账户启动,因此apache提供了apache2ctl(Apache HTTP Server Control Interface)工具来使用。
I believe this is because etc/init.d is not in your command path. Unlike Windows, Linux does not look in the "current" directory for commands. So, if you are in /etc/init.d you can type "sudo ./apache2 restart" which will tell it to look in the current directory with the "./" The script in /etc/init.d/apache2 explicitly reads in the environment variables before calling /usr/sbin/apache2. /usr/sbin/ is in yoour command path, so that is the one that runs when you just type "apache2 ..."