действительно ли возможно перезагрузить httpd от php

Можно получить драйверы, которые позволяют Windows и Mac читать EXT2 или разделы EXT3, так, чтобы могла бы быть альтернатива.

Кроме того, если у Вас есть несколько разработчиков, работающих над той же кодовой базой, действительно необходимо осуществлять управление версиями. При наличии страдающей боли с Подверсией Вы могли бы хотеть проверить мерзавца вместо этого. Это распределило (что означает, что больше нет центрального сервера, размещающего одну удостоверенную копию кодовой базы), и имеет намного лучшую поддержку того, чтобы перейти и объединиться. Это доступно для всех главных платформ разработки.

1
задан 31 August 2011 в 11:25
3 ответа

Execute commands requires root from PHP is not good idea. I would suggest you monitoring the /etc/httpd/conf.d folder and reload Apache whenever it changes. Take a look at incron.


Install it from rpmforge repository:

# yum -y install incron

Edit root's crontab with incrontab -e:

/etc/httpd/conf.d/ IN_CREATE,IN_DELETE,IN_MODIFY /etc/init.d/httpd reload

Start it:

# service incrond start
# chkconfig incrond on

and create a .conf file in /etc/httpd/conf.d and take a look at /var/log/cron to see what happens.

4
ответ дан 3 December 2019 в 16:52

I would do this by having php create a directory somewhere in the filesystem and then have a cron script run as root that would check for the existence of the directory and restart the HTTP server if it exists and remove the directory. This way at least you are not giving the httpd user too much privilege.

1
ответ дан 3 December 2019 в 16:52

The PHP script could invoke "apachectl restart" via sudo (ie, sudo /usr/sbin/apachectl restart), and sudo could be configured to permit the user that runs httpd (and therefore, presumably, the PHP script) to run that command without password. This line of sudoers code would achieve that:

apache  ALL=(root) NOPASSWD: /usr/sbin/apachectl restart

Obviously, you will need to ensure that the user and path there are correct for your environment; mine are taken from a CentOS 5 system.

1
ответ дан 3 December 2019 в 16:52

Теги

Похожие вопросы