When you install self-compiled Apache and MySQL, they are not added as system services by default, so we need to manually add them as services.
Adding Apache as a System Service
Copy
apachectlto theinit.ddirectory# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpdEdit
httpd# vi /etc/rc.d/init.d/httpdAdd the following comment lines:
# chkconfig: 345 85 15 # description: Apache serverAdd Apache to the system services
# chkconfig --add httpd
Adding MySQL as a System Service
Copy MySQL to the
init.ddirectory# cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqldAdd
mysqldto the system services# chkconfig --add mysqld
After completing the above steps, you can use:
# service httpd/mysqld restart/start/stop
to control the start, stop, and restart of Apache/MySQL.