CENTOS7 Installation APACHE2+MARIADB+PHP5 Process detailed

Source: Internet
Author: User
Tags curl install php php server administrator password

1. Enable Apache2


Centos7 The HTTPD service is installed by default, but it is not started. If you need a new installation, you can yum install-y httpd


Start service: Systemctl start Httpd.service

Set boot auto start: Systemctl enable Httpd.service


The HTTP server has been started for a simple configuration


Vim/etc/httpd/conf/httpd.conf #编辑文件


Serversignature on #添加, the Apache version is displayed on the error page, off is not displayed


Options Indexes followsymlinks #修改为: Options includes execcgi followsymlinks (Allow server to execute CGI and SSI, disallow listing of directories)


#AddHandler cgi-script. CGI #修改为: AddHandler cgi-script. cgi. PL (allows CGI scripts with a. pl extension to run )


AllowOverride None #修改为: allowoverride All (Allow. htaccess)


Adddefaultcharset UTF-8 #修改为: Adddefaultcharset GB2312 (add GB2312 as default encoding)


#Options Indexes followsymlinks #修改为 Options followsymlinks (does not show the tree structure on the browser)


DirectoryIndex index.html #修改为: DirectoryIndex index.html index.htm default.html default.htm index.php (set default home file, add index.php)


Maxkeepaliverequests #添加MaxKeepAliveRequests 500 (increase the number of simultaneous connections)


: wq! #保存退出


systemctl Restart Httpd.service #重启apache


2. Installing the MariaDB database


In CentOS 7.0, the MySQL database has been replaced with MARIADB, because the prospect of MySQL being acquired by Oracle is worrying,

So MySQL brother Mariadb out and continues the open source business

Installation: yum-y Install Mariadb-server mariadb


start: Systemctl start Mariadb.service

Systemctl Enable Mariadb.service #开机自启动


Configuration: cp/usr/share/mysql/my-huge.cnf/etc/my.cnf Overwrite the original configuration is good.
Set database administrator password: mysql_secure_installation All the way y can, of course, the first time after Y to enter the password two times.


This is an explanation of some of the instructions.
Systemctl start mariadb ==> start mariadb
Systemctl enable mariadb ==> boot from
Mysql_secure_installation ==> Setting the root password and other related
mysql-uroot-p123456 ==> Test Login!




3. Installing PHP5
Install PHP Main program: yum-y install PHP


Install PHP components to enable PHP support MariaDB


Yum-y Install PHP-GD php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp Php-soap Curl Curl-devel


Restart: systemctl Restart Httpd.service

Configuration: Vim/etc/php.ini


//Partial configuration

Date.timezone = PRC #把前面的分号去掉, changed to Date.timezone = PRC

Disable_functions = Passthru,exec,system ... #列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.

expose_php = Off #禁止显示php版本的信息

Short_open_tag = on #支持php短标签


Test: vim/var/www/html/index.php input <?php phpinfo ();?>


Wq Save exit. Open http://192.168.1.108 If you can see the PHP configuration Information page, the PHP server is OK.

Copyright notice: Hello, everyone!

CENTOS7 Installation APACHE2+MARIADB+PHP5 Process detailed

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.