Centos-yum-lamp Environment

Source: Internet
Author: User

  

Install Apache2 First
One command:
Yum-y Install httpd
When you enter, Yum prompts you for the httpd version that is currently installed, updates it automatically, and installs it automatically if it is not installed. Note Enter "Y" during the Yum installation process to confirm the installation.
After the Apache installation is complete, manually start the Apache2:
/ETC/INIT.D/HTTPD start
At this point, you can see the default page of Apache2 by entering the IP address of the server directly in the browser. At this point, Apache can only provide HTTP services, cannot execute PHP, and can not connect to MySQL database.

Install MySQL
Since MySQL is already included in CentOS, only Yum is required:
Yum-y install MySQL Mysql-server
When you are done, start the MySQL service using the following command:
/etc/init.d/mysqld start

Installing PHP5
Install PHP5 using the following command:
Yum Install PHP
After installing PHP5, you must restart Apache to make PHP effective:
/ETC/INIT.D/HTTPD restart
At this point, Apache can already parse and execute PHP scripts. Because Apache's default Web site root is located at:/var/www/html/, a info.php is established in this directory to test the correct installation of apache+php:
VI <?php phpinfo ();

The/info.php is then accessed in the browser, and the output information for the phpinfo appears:


PHP and Apache are installed correctly.
Next install 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 wait patiently. Reboot Apache again after completion:
/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:


The lamp operating environment is initially installed. Finally, you need to set the lamp component to start automatically:
1
Chkconfig--levels 2345 httpd on
2
Chkconfig--levels 2345 mysqld on

Finally, the related configuration and environment are introduced.
Apache Master Config file:/etc/httpd/conf/httpd.conf
The Apache master configuration directory allows you to categorize different types of configurations into this directory:/etc/httpd/conf.d/
Apache Web site root directory:/var/www/html/
Apache log file directory:/VAR/LOG/HTTPD
MY.CNF configuration file for MySQL:/etc/my.cnf
MySQL database file location:/usr/lib/mysql

Centos-yum-lamp Environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.