Deploying Lamp in CentOS 7 (linux,apache,mariadb,php)
Description : Centos 7 replaces MySQL with mariadb, but the PHP connection mariadb still uses the Php-mysql module.
"From Wikipedia"
MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk.
MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL. In the storage engine, the 10.0.9 version uses xtradb (named aria) instead of MySQL's InnoDB.
1. Preparation before installation
Shutting down firewalls and Seliux
Temporarily closed, effective immediately, but fails after rebooting the system.
Permanently closed, does not take effect immediately, but takes effect after the system restarts.
2. Configure the Yum source
See blog:
http://wangjun51.blog.51cto.com/6124567/1260001
3. Deploying Apache
-
yum Install httpd //install Apache
-
systemctl start Httpd.service //Start Apache now
-
systemctl enable Httpd.service //Add Apache to boot from boot
-
4. Deploying MARIADB
-
yum Install mariadb-server /install mariadb
-
systemctl Start Mariadb.service
-
systemctl enable Mariadb.service //Add mariadb to boot from startup
-
5. Initialize the MARIADB Administrator password (optional action)
5. Deploying PHP
Yum install php php-mysql //install PHP and connect mariadb module
echo "extension=msql.so" >>/ect/php.ini //Open PHP connection mariadb extension function
6. Verification
Create a test page
cat/var/www/html/test.php
<?php
$conn = mysql_connect ("localhost", "root", "");
if ($conn)
echo "OK";
Else
echo "Fail";
Mysql_close ();
Phpinfo ();
?>
2. Access Testing
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/78/FA/wKiom1aE2ADzuJZkAAGRE6LhDPw340.png "title=" Centos7lamp.png "alt=" Wkiom1ae2adzujzkaagre6lhdpw340.png "/>
7. Fault Handling
Fault 1:
PHP Fatal error:call to undefined function mysql_connect ()
The PHP connection mariadb extension is not turned on.
echo "extension=msql.so" >>/ect/php.ini
Systemctl Restart Httpd.service
Fault 2:
The server ' s fully qualified domain name, using 127.0.0.1. Set the ' server...his message
Apache default site name not set
echo "' ServerName 127.0.0.1 ' >>/etc/httpd/conf/httpd.conf"
Systemctl Restart Httpd.service
This article from "Life in the diligent, not So Ho get" blog, please be sure to keep this source http://wangjun51.blog.51cto.com/6124567/1730441
Deploying Lamp in Centos 7