Home > Article > Backend Development > LAMP environment: steps to build a lamp environment
This article introduces you to the LAMP environment: the steps to build a lamp environment. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Preparation
1. Preparation materials:
Linux CentOS-6.5
Xshel
Xftp
Installation Package ECShop_v3.6.0_UTF8_release170608
Note: If the installation package is not available, you can download it from the official website
2. Open Linux CentOS-6.5 Xshel Xftp 3 software
3. Enter Windows and copy the file installation package to /var/www/html/ in Linux. Use Xftp for this step.
4. Check whether the compilation tool gcc exists in the system (gcc checks to see if there is , optional)
(The gcc tool is mainly a tool for compiling c language, and the installed source code is mainly written in c language)
Use the command (gcc -v), if you can see the version number of gcc Information, indicating that this tool exists and can be used. If you don’t have it, you can download and install it
There is no gcc tool here, use yum -y install gcc to download
The first step is to install
1. Set up a lamp environment. To ensure that your virtual machine can connect to the Internet, the yum installation used here can help us solve the dependencies of the software itself. The command is as follows
yum -y install php ----安装PHP yum -y install php-mbstring ---安装PHP扩展 yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc ---和mysql扩展的
Second step, restart Apache
After installing the above software (php and its related extensions), you must restart apache, start the apache service and check if the startup is successful
The command is as follows: (Remember to use the root user to start the service)
Method 1
Stop the httpd command (temporary):
Service httpd stop
Stop the httpd command (permanent) ):
chkconfig httpd off
Start httpd command (temporary):
service httpd start
Start httpd command (permanent):
chkconfig httpd on
Method 2
Stop the httpd command (temporary):
Service httpd stop
Stop the httpd command (permanent):
chkconfig httpd off
Enter the directory to start the httpd command:
/etc/rc.d/init.d/httpd start
Check whether httpd is started
Check the startup result:
ps aux | grep httpd
You can also use service httpd status to check
The third step is to unzip the installation package and transfer it to the HTML directory
Note: /var/www/html/ is the default directory of the Apache HTTP server (as shown in the figure below)
A. Go to /var/www/html/ and decompress ECShop_v3.6.0_UTF8_release170608.zip
Unzip command:
unzip ECShop_v3.6.0_UTF8_release170608.zip
B. Then uninstall the original installation package
Uninstall command:
Rm -rf ECShop_v3.6.0_UTF8_release170608.zip
Note: For a better experience, it is convenient to enter the "Registration Page" , skip other tedious steps here, and deliberately change the original path location of the "Registration Page". The steps are as follows:
Enter ECShop_v3.6.0_UTF8_release170608
Command:
cd ECShop_v3.6.0_UTF8_release170608
Command: ll
Enter source
Command:
Cd source
Then copy ecshop appserver to /var/www/html/
Command :
cp -r ecshop /var/www/html
Command:
cp -r appserver /var/www/html
Then enter the /var/www/html/ file to check whether the copy is successful
Command:
cd /var/www/html
Check again whether the copy is successful Success
Command: ll
And delete the redundant ones, keep appserver ecshop
Command: rm -fr File name
The fourth step, Modify permissions
In the next operation, permissions are required to enter the web page. We need to increase the permissions of ecshop appserver in advance
Command:
chmod -R 777 ecshop
Command:
chmod -R 777 appserver
The fifth step, open your own ECShop with a browser
Enter your IP to open, such as: 172.16.1.15/ecshop
"Register" appears Page" is successfully built
The sixth step is to handle the failure to open the Apache web page
After checking that the above steps are correct, then set apache and mysql to start Self-starting, iptables will automatically shut down after booting, follow the steps below
Note: Check whether the program is enabled or disabled in the shell or Linux CentOS-6.5 interface
chkconfig mysqld --list Check whether MySQL is enabled ?
Chkconfig httpd --list Check if Apache is turned on? Httpd is the software name of Apache
Chkconfig iptables --list Check whether the firewall is turned off?
If it is not turned on or off, follow the instructions below
Enter chkconfig mysqld on to turn on MySQL, then enter service mysqld status to check whether it is turned on successfully
Enter chkconfig httpd on to turn on Apache, then enter service httpd status to check whether it is turned on successfully
Enter chkconfig iptables off to turn off the firewall, and then enter service iptables status to check whether it is turned off
Restart (optional), in If all the above commands are executed and it still cannot be opened, you can try to use restart
Enter reboot to restart Linux CentOS
You can see the restart icon in Linux centos
Re-log in as root user
Re-open the shell. After Linux CentOS restarts, the shell will also be disconnected from the Internet. You need to re-open it
Enter your IP/ecshop in the browser and open
If the "Registration Page" appears, the environment is successfully established!
Recommended related articles:
The basic working principle of middleware in the pipeline design mode in the Laravel framework
The above is the detailed content of LAMP environment: steps to build a lamp environment. For more information, please follow other related articles on the PHP Chinese website!