Install and configure the LAMP environment in CentOS6.4

Source: Internet
Author: User

This article describes in detail how to install and configure the LAMP service in CentOS6.4 system, that is, to install Apache + PHP + Mysql. Refer to the settings of the online gods. For other Linux distribution systems, refer ~

In this article, some command operations require the root permission. Enter the ''command and enter the password to switch the root identity.

The setting file allows port 80 and port 3306. Because port 80 is the port used by the http protocol, if the firewall disables port 80, the website cannot be accessed from the Internet even after it is configured. Port 3306 is the default port of the MySql database. Use VIM to open the iptables file and add rules:

 

  vim /etc/sysconfig/   -A INPUT -p tcp -m state --state NEW -m tcp --dport  - -A INPUT -p tcp -m state --state NEW -m tcp --dport  -j ACCEPT

 

 

 

After adding the file, it should be shown in the following figure. If you have modified the file before, the file may be slightly different from the author's figure:

 

  

2. Disable SELINUX

. For the currently available security modules, SELinux is the most comprehensive function. Basically, it uses Server Load balancer devices for traffic distribution and only opens several ports to the outside. Therefore, in terms of security and complexity, SELinux is not cost-effective. Disable SELinux after modifying the file.

 vim /etc/selinux/   SELINUX= SELINUXTYPE=   SELINUX=disabled

'Restart the system.

 

 

    mysql mysql-   /etc/init.d/       /usr/share/mysql/my-medium.cnf /etc/my.cnf

 

MySql settings:

 



 

After the setting is successful, restart the MySql service:

 /etc/init.d/ /etc/init.d/mysqld start

 

2. install and configure the Apache service

  

      /etc/init.d/   vim /etc/httpd/conf/           /etc/init.d/httpd restart

3. install PHP

  

  php

Install the PHP plug-in:

  php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

After the installation is complete, do not forget to restart Apache and MySql:

/etc/init.d//etc/init.d/httpd restart

  

The installation of the software is complete, and then the configuration and testing are conducted.

/Etc/httpd/conf/modify to change to ServerSignature Off to change to as needed

After the modification is complete, save and restart Apache to delete the test webpage:

/etc/init.d/ -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html 

 

 

Vim/etc/modify to set settings

 

After the modification is completed, restart the service:

/etc/init.d//etc/init.d/httpd restart

 

 

 

Enter"< em>

< em> 

< em> <?      ?>

< em> 

< em>After saving and exiting, enter localhost in the browser to view the php information:

< em> 

< em>Apache. apache-R/var/www/html

< em> 

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.