1. Install apahce,PHP,MySQL,
And PHP connection to MySQL library components.
Yum-y install httpd PHP MySQL mysql-server PHP-MySQL
2. Configure the startup Service
/Sbin/chkconfig httpd on[SettingsApacheServer httpd service startup]
/Sbin/chkconfig -- add mysqld[Add a MySQL service to the service list]
/Sbin/chkconfig mysqld on [Set MySQL Service Startup]
/Sbin/service httpd start[Start the HTTPd service, which has nothing to do with startup]
/Sbin/service mysqld start[Start MySQL service, not related to boot]
3. Set the password of the root account of the MySQL database.
Mysqladmin-u Root Password 'newpassword'[Enter the password in quotation marks]
4. Make MySQL database more secure
Mysql-u root-P
Mysql> drop database test;[Delete the test database]
Mysql> Delete from mysql. User where user = '';[Delete anonymous accounts]
Mysql> flush privileges;[Overload permissions]
5. According to the above installation method, the default site directory configured is/var/www/html/
Create a PHP script:
<? PHP
Phpinfo ();
?>
6. Create a NewDatabaseTo add a database user and set user permissions. Write a PHP script to test the database connection.
Mysql> Create Database my_db;
Mysql> grant all privileges on my_db. * To 'user' @ 'localhost' identified by 'Password ';
// Install Apache extension Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql // install PHP extension Yum-y install PHP-Gd PHP-xml php-mbstring PHP-ldap php-Pear php-XMLRPC // install MySQL extension Yum-y install mysql-connector-odbcmysql-devel libdbi-DBD-MySQL
Disable SELinux. // local debugging. For network servers, refer to SELinux configuration.