Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

restart apache from php

Status
Not open for further replies.

cfvogue

Technical User
Jul 23, 2001
57
0
0
NL
Hi all,

Do you guys no if it's possible to restart apache from a php script? Or, to be more precise, add VirtualHosts on the fly?

If it is possible it's probably not very safe. Anyway, does anyone have anything helpful to say?

Thanks a lot
 
Hi

Fortunately is not possible. The only way should be something like this :
Code:
system('echo "/etc/init.d/httpd restart" | at now + 1 minutes');
But hopefully there will be permission problems to not be able to do that.

There are webservers which have built-in web based administration, like Xitami and Abyss. Is possible that Google heard about such module for Apache. I did not.

Feherke.
 
You could allow the apache user to restart the httpd service by using sudo, I don't know a great deal about the security implications this would have though.
 
If you used mass virtual hosting or UserDir methods, you wouldn't have to restart apache every time a new account was setup. Your script would just have to create the user and home directory. In the case of mass virtual hosting, the directory would have to be the same as the domain name such as /var/ Inside that would be the DocumentRoot and cgi-bin directories. The script would need to set the permissions. If you use UserDir a directory such as public_html would be created. If you don't use either of these, you should use graceful rather that a hard restart. Restart just bumps people off.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top