开发者

how can i reload the httpd service with php

开发者 https://www.devze.com 2023-04-01 09:13 出处:网络
how can you reload the httpd service from php? I have tried: system(\"/bin/echo \'/sbin/service httpd reload > /dev/n开发者_如何学JAVAull 2>&1\' | /usr/bin/at now\");

how can you reload the httpd service from php?

I have tried:

system("/bin/echo '/sbin/service httpd reload > /dev/n开发者_如何学JAVAull 2>&1' | /usr/bin/at now");

but it seemed to only work once

i have LAMP with no control panel and am adding subdomains via php and need to reload the httpd service after each conf file i create.


Most likely your webserver is running as root. Therefore, reloading it requires root as well. In that case you can use sudo to restart it. However, unless php scripts run as the vhost user, users from other vhosts will be able to do that too (if they somehow figure out which command to call). At any time, use apachectl configtest first to validate the config before reloading it, just to see if the config is reloadable without any problems.

0

精彩评论

暂无评论...
验证码 换一张
取 消