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