640 Part IV: Using PHP for Sysadmin Tasks (Web hosting control panel)
Friday, April 25th, 2008640 Part IV: Using PHP for Sysadmin Tasks Here is a sample output: Creating user account: mrfrog with password 12345 shell=/bin/true Creating r2d2.example.com configuration Create directories /bin/mkdir -m 0755 -p /www/r2d2.example.com /bin/chown -R mrfrog:mrfrog /www/r2d2.example.com /bin/chmod -R 0755 /www/r2d2.example.com /bin/mkdir -m 0755 -p /www/r2d2.example.com/htdocs /bin/chown -R mrfrog:mrfrog /www/r2d2.example.com/htdocs /bin/chmod -R 0755 /www/r2d2.example.com/htdocs /bin/mkdir -m 0755 -p /www/r2d2.example.com/logs /bin/chown -R mrfrog:mrfrog /www/r2d2.example.com/logs /bin/chmod -R 0755 /www/r2d2.example.com/logs Checking syntax: /usr/local/apache/conf/vhosts/r2d2.example.com Syntax OK Appending Include /usr/local/apache/conf/vhosts/r2d2.example.com in /usr/local/apache/conf/httpd.conf # # # Following line loads configuration # for the r2d2.example.com virtual host Include /usr/local/apache/conf/vhosts/r2d2.example.com Creating symbolic link using /bin/ln -s /www/r2d2.example.com /home/mrfrog/r2d2.example.com /bin/cp -r vhosts/standard/htdocs/* /www/r2d2.example.com/htdocs Sending mail to using vhosts/std_vhost.mail Summary In this chapter, you learned how to develop a command-line PHP script that helps you manage Apache virtual hosts on your Linux system. Using this script creating, changing, and removing virtual servers becomes almost easy. Remember to visit www.apache.orgfor documentation on Apache and more directives for use with virtual hosts.