Home > Backend Development > PHP Tutorial > centos-yum-lamp environment

centos-yum-lamp environment

WBOY
Release: 2016-08-08 09:32:59
Original
862 people have browsed it

 

First install Apache2
Just one command:
yum -y install httpd
After pressing Enter, yum will prompt the currently installed version of httpd and update it automatically; if it is not installed, it will be installed automatically. Note to enter "Y" during the yum installation process to confirm the installation.
After the Apache installation is completed, manually start Apache2:
/etc/init.d/httpd start
At this time, directly enter the IP address of the server in the browser, and you will see the default page of Apache2. At this time, Apache can only provide HTTP services, cannot execute PHP, and cannot connect to the MySQL database.

Install MySQL
Since MySQL is already included in CentOS, you only need yum:
yum -y install mysql mysql-server
After completion, use the following command to start the MySQL service:
/etc/init.d/mysqld start

Install php5
Use the following command to install php5:
yum install php
After installing php5, you must restart Apache for php to take effect:
/etc/init.d/httpd restart
At this time, Apache can already parse The php script is executed. Since the default website root directory of Apache is located at: /var/www/html/, create an info.php in this directory to test whether Apache+PHP is correctly installed:
vi
Then access /info.php in the browser, and the output information of PHPINFO appears:


PHP and Apache have been installed correctly.
Next install the MySQL database and other modules (such as GD graphics library, mbstring library, etc.):
yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
The installation process may be slow, please be patient. After completion, restart Apache again:
/etc/init.d/httpd restart
Re-open the IP/info.php page in the browser, you should be able to find MySQL, GD, mbstring and other modules:


At this time, the LAMP operating environment has been The preliminary installation is completed. Finally, you need to set the LAMP component to start automatically:
1
chkconfig --levels 2345 httpd on
2
chkconfig --levels 2345 mysqld on

Finally introduce the relevant configuration and environment
Apache main configuration file: /etc/httpd/ conf/httpd.conf
Apache main configuration directory. Different types of configurations can be classified into this directory: /etc/httpd/conf.d/
Apache website root directory: /var/www/html/
Apache log file Directory: /var/log/httpd
MySQL my.cnf configuration file: /etc/my.cnf
MySQL database file location: /usr/lib/mysql

The above introduces the centos-yum-lamp environment, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template