Tools/Materials
- Virtual machines and CentOS operating systems
- Use of basic Linux commands
Method/Step
First of all, in order to build a stable lamp practice environment, make sure that your virtual machine can be connected, here we use the Yum installation, It helps us to solve the software's own dependencies. I've added the PostgreSQL database back. The parameters of PostgreSQL can be removed if not needed. command is as follows
Yum-y install httpd mysql mysql-server php php-mysql postgresql postgresql-server php-postgresql php-pgsql php-devel
Yum installation process, about 1-2 minutes
Launch Apache service and view time to start successfully
The command is as follows: (Remember to start the service with the root user)
Start:/ETC/RC.D/INIT.D/HTTPD start
Detect startup results: PS aux | grep httpd
View the IP of the server and go to the Web site root to create a new phpinfo.php program for viewing PHP-related configuration information.
If this goes well, then we'll proceed to the MySQL database configuration
The command is as follows:
Start:/etc/rc.d/init.d/mysqld start
Check startup results: NETSTAT-TULNP | grep:3306
Change root password: mysqladmin-u root password ' password you want to set '
Enter the MySQL database, create a demo library and a person table for testing, and insert test data
Finally, write the PHP test code to connect to MySQL to detect whether MySQL can work properly with PHP
CentOS match lamp (Php+mysql+apache) environment--Baidu Edition