LAMP best configuration for Lamp in centos 6.6 and centos 6.7

What is LAMP?

LAMP = Linux+Apache+MySQL/MariaDB+Perl/PHP/Python

A common collection of open source software to build dynamic Web sites or servers, are separate programs in and of itself, but are often put together, with an increasing high degree of compatibility, constitute a powerful Web application platform. With the booming trend of open source, open source LAMP and J2EE and. Net commercial software played trend, and the software development of the project in terms of software investment costs are relatively low, therefore the concern of IT community as a whole. Traffic from a Web site, 70% per cent of the traffic is provided by LAMP, LAMP is the most powerful website solution.

First of all update update

4. use yum to install Apache,Mysql,PHP.

Installing Apache
yum install httpd httpd-devel
After the installation is complete, use/etc/init.d/httpd start start the Apache
Set as startup: chkconfig httpd on

Install MySQL
yum install mysql mysql-server mysql-devel
Similarly, complete, used/etc/init.d/mysqld start start MySQL

Set a MySQL password
mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD(‘newpassword’) WHERE user=’root’;

Set a MySQL password can also be used: mysql_secure_installation command

Allow remote login
mysql -u root -p
Enter Password: <your new password>
Mysql>GRANT ALL PRIVILEGES ON *. * TO ‘ user name ‘@’%’ IDENTIFIED BY ‘ password ‘ WITH GRANT OPTION;
After the completion of MySQL-front can remotely manage MySQL.
Set as startup
chkconfig mysqld on

Install PHP
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start

In/var/www/html/create a test.php file, writes the following contents, and then save it.
Firewall configuration
A. Add. allow access to port {80:http}.
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
B … turn off the firewall of {} is not recommended.
service iptables stop
C. reset to load the firewall
service iptables restart

Then open http://ServerIP/test.php in the browser on the client, if he successfully showed that indicates that the installation was successful.
At this point, the installation is completed.

CentOS virtual machine, allowing remote access to a specific port

Change mode:
Switch to the root user
Open the iptables configuration file:/sysconfig/iptables.old
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

To solve the problem you have to know where the problem lies, so you must know more detailed description of the problem to just go. In fact, you only need to configure PHP.ini. Find the PHP.ini file in your PHP install directory and open, locate display_errors, display_errors = Off by default and change Off to On, save to close the file, and restart Apache.

The start command:
/Etc/init.d/httpd start start the Apache

/Etc/init.d/mysqld start start MySQL

Store PHP files in the var/www/html directory

In a Linux environment to install and configure phpMyAdmin

The installation and configuration is CentOS 6.6 system, this system has been deployed lnmp environment.PhpMyAdmin installation, you can choose the way yum to install online, or you can download on their official website, and then unzip to a directory on your Web server.

Step1. Configuring rpmforge and EPEL-source for CentOS. CentOS official sources are enough, but like PHP extensions such as PHP-mcrypt and not in the official source.
Rpmforge source you can download and install in, known as rpmforge-release-*.i686.rpm or rpmforge-release-*.x86_64.rpm, look for the latest version
EPEL source can be found at, 32 in the I386 folder of the system, the 64-bit x86_64 folder, named EPEL-release-6-*.noarch.rpm, to find the latest version


Http:// download


Http://mirrors.opencas.CN/EPEL/6/i386/EPEL download

Here with a 32-bit system for example,
# If The requested URL returned error:404, please go into the latest version
Http:// to view the records in a virtual machine (txt in the desktop directory)
rpm -ivh

# Install PHP extensions
yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo
yum -y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear

# Install phpMyAdmin
yum -y install phpmyadmin

After the installation is complete, phpMyAdmin can be found in the/usr/share directory, and copy it to your Web Directory, for example my Web directory is:/var/www/html
Modify config.Inc.php file under the directory

$cfg[‘PmaAbsoluteUri’] = ‘’; PhpMyAdmin address where

$cfg[‘Servers’][$i][‘host’] = ‘’; Set up MySQL host name or IP address, where usually you can keep the default localhost

$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’; In this machine the test config or cookie, suggested here by cookie

$cfg[‘Servers’][$i][‘user’] = ‘root’; Set up MySQL user name

$cfg[‘Servers’][$i][‘password’] = ‘password’; Set MySQL user password

$cfg[‘DefaultLang’] = ‘zh-utf-8’; Set the default language

After setting the above parameters to save exit, restart the Web server. open browser, enter in the address bar to test it.