CentOS 7 x64 Apache+mysql (MARIADB) +php56 installation Tutorials Detailed _linux

Source: Internet
Author: User
Tags mcrypt phpmyadmin

Every time you build a new server, you have to go back and forth these packages again, to go back and forth more than 20 times, the original is based on experience, the configuration process repeatedly into the pit is unavoidable, so write this article to make a memo. Although there are integration packages like XAMPP, it is reassuring to install them on a Linux distribution in a production environment or through a package management tool. The new server is CentOS 7 (7.2) system, the relevant configuration is mainly in this version, for the convenience of operation, direct use of root User Configuration.

CentOS 7 source is older, PHP is PHP 5.4, we want PHP 5.6, this requires the following command to add additional Remi source.

RPM-IVH http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

When the preparation is complete, execute the following command:

#yum Install httpd
#yum install mariadb mariadb-server
#yum Install--enablerepo=remi--enablerepo=remi-php56 PHP php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-phpunit

APACHE,MYSQL,PHP56 is installed, from the above instructions will find no MySQL and mysql-server. This is because MySQL has a copyright problem, since CentOS 7 has been removed, replaced by MARIADB and Mariadb-server, they are designed to be fully compatible with Mysql,mysql-server, and PHP, in addition to its own also installed mbstring , Mcrypt,mysqlnd and other plug-ins, these are necessary in most projects, if there is no installation may appear open the Site a blank, check the log is not wrong.

Now let's look at the configuration of Apache. Apache can be used directly after the installation, execute the command to start manually, and add it to the boot boot.

#systemctl start httpd #手动启动
#systemctl enable httpd #添加开机启动

Perform a netstat-tln check to see if 80 ports are listening if there is a successful start in the listening instructions.

And then open the Apache default profile, which is located /etc/httpd/conf/httpd.conf , and find DocumentRoot this line, usually the result is

DocumentRoot "/var/www/html"

That represents the site root directory located /var/www/html . Executes in this directory echo "It Works!" > index.html (if you already have the file, you don't have to create it yourself). Then execute the following command to test the Web site for normal access.

#curl http://127.0.0.1/
It works! #输出该结果表示一切正常

Of course, you can also access tests directly in the browser. Note that if you are accessing from another computer, you must first perform the next iptables -F empty firewall, otherwise you will not be able to access it.

Then we'll look at the configuration of PHP. Normally, after the installation of PHP56, the corresponding configuration file will be generated under Apache, confirming that the following files are generated :/etc/httpd/conf.modules.d/10-php.conf,/etc/httpd/modules/libphp5.so,/etc/httpd/conf.d/php.conf .

Also create a PHP test file by executing the following command at the site root:

#echo "<?php phpinfo?>" > info.php

Access to the next http://localhost/info.php, can display PHP configuration information that means PHP installation is successful, if not, perform a restart apachectl restart of the Apache server to try, if the failure of other places to find reasons.

Finally look at the installation and configuration of MySQL. Execute the following command, start manually, then add to boot, then start the MySQL server's initial configuration.

#systemctl start mariadb 
#systemctl enable mariadb
#mysql_secure_installation #完成mysql首次初始化

When finished, execute

mysql -uroot -p<Just set the password > login to see if successful description of MySQL configuration ok.

The configuration of this server is complete.

Additional configuration

Modern PHP development is basically built on top of composer, and it is necessary to perform the following commands to install composer.

#yum Install--enablerepo=remi--enablerepo=remi-php56 composer

phpMyAdmin used to manage MySQL is also very convenient, /var/www/html below, download and decompression on the completion can be.

wget https://files.phpmyadmin.net/phpMyAdmin/4.6.5.1/phpMyAdmin-4.6.5.1-all-languages.zip
MV Phpmyadmin-4.6.5.1-all-languages phpMyAdmin

It is recommended that phpMyAdmin prohibit root landing, will be more secure, modify the method: Enter the phpMyAdmin directory, open libraries/config.default.php , find the following line,

cfg[' Servers ' [$i] [' allowroot '] = true;

will be true replaced false .

The above is a small set to introduce the CentOS 7 x64 under the Apache+mysql (MARIADB) +php56 Installation Tutorials Detailed, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

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.