Home > Article > Backend Development > Use yum to install the php lamp environment
CentOS 6.5 uses yum to install LAMP (php running environment)
Today, I used the yum method to build a LAMP environment. I encountered many problems in the process. After the help of google and seniors, I finally set up the environment. Now I have put the complete Record the steps,
2. Use yum to install Apache, Mysql, PHP.
2.1 Install Apache
yum install httpd httpd-devel
After the installation is completed, use /etc/init.d/httpd start to start apache
Set to boot Start: chkconfig httpd on
2.2 Install mysql
2.2.1 yum install mysql mysql-server mysql-devel
Similarly, after completion, use /etc/init.d/mysqld start to start mysql
2.2.2 Set mysql password
mysql> ; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
2.2.3 Allow remote login
mysql -u root -p
Enter Password :
mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
After completion, you can use mysql-front to remotely manage mysql.
2.2.4 Set to start at boot
chkconfig mysqld on
3. Install php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
4. Test it
4.1 Create a new test.php file in /var/www/html/, write the following content, and save it.
phpinfo();
?>
4.2 Firewall configuration
a. Add. Allow access to ports {21: ftp, 80: http}.
iptables -I RH-Firewall-1-INPUT -m state – state NEW -m tcp -p tcp –dport 21 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
b. Turn off the firewall {not recommended}.
service iptables stop
c. Reset the loading firewall
service iptables restart
4.3 Then open http://serverip/test.php in the client browser. If it can be displayed successfully, It means the installation is successful.
Now, the installation is complete. Sigh, yum is so useful.
The above introduces the use of yum to install the php lamp environment, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.