Linux under Installation configuration apache+php+mariadb

Source: Internet
Author: User

First, install Apache

1. Download and install Apache

Yum Install httpd

2. Start Apache

Systemctl Start Httpd.service

3. Stop Apache

Systemctl Stop Httpd.service

4. Restart Apache

Systemctl Restart Httpd.service

5. Set Apache to boot

Systemctl Enable Httpd.service

Second, install PHP

1. Download PHP

Yum Install PHP

2. Install the PHP component to support MARIADB

Yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath Php-mhash

Third, installation mariadb
1. Download and install MARIADB

Yum Install mariadb Mariadb-serve

2. Start MARIADB

Systemctl Start Mariadb.service

3. Stop MARIADB

Systemctl Stop Mariadb.service

4. Restart MARIADB

Systemctl Restart Mariadb.service

5. Set the mariadb to boot

Systemctl Enable Mariadb.service

6, copy the configuration file (Note: if the/etc directory has a default MY.CNF, directly overwrite can be)

Cp/usr/share/mysql/my-huge.cnf/etc/my.cnf

7. Set the password for the root user

Mysql_secure_installation

After setting the password, always enter Y as prompted.

Last appearance: Thanks for using mysql!

Finally, restart the mariadb.

Iv. Configuring Apache

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)

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

: wq! #保存退出

Systemctl Restart Httpd.service #重启apache

V. Configuration of PHP

Vi/etc/php.ini #编辑

Date.timezone = PRC #找到date. TimeZone, remove the preceding semicolon and change it to Date.timezone = PRC

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

Short_open_tag = on #支持php短标签

: wq! #保存退出

Systemctl Restart Mariadb.service #重启MariaDB

Systemctl Restart Httpd.service #重启apache

Test: Try to write a php file in/var/www/html

Linux under Installation configuration apache+php+mariadb

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.