First, install Apacheserver
<code>yum <span>install</span> httpd</code>
Second, install PHP and common software packages
<code>yum install php httpd<span>-manual</span> mod_ssl mod_perl mod_auth_mysql yum install php<span>-gd</span> php<span>-xml</span> php<span>-mbstring</span> php<span>-ldap</span> php<span>-pear</span> php<span>-xmlrpc</span> yum install mysql<span>-connector</span><span>-odbc</span> mysql<span>-devel</span> libdbi<span>-dbd</span><span>-mysql</span></code>
Third, install MariaDB
<code>yum <span>install</span> mariadb* </code>
Fourth, start the service
<code>systemctl <span><span>start</span> httpd.service systemctl <span>start</span> mariadb.service</span></code>
Fifth, if the fourth step is successful, then Set up two services to start automatically
<code>systemctl enable httpd<span>.service</span> systemctl enable mariadb<span>.service</span></code>
Sixth, set up the database server
<code>[root@rachel ~]<span># mysql -u root #无密码登录数据库</span> Welcome <span>to</span><span>the</span> MariaDB monitor. Commands <span>end</span><span>with</span> ; <span>or</span> \g. Your MariaDB connection <span>id</span><span>is</span><span>3</span> Server <span>version</span>: <span>5.5</span><span>.44</span>-MariaDB MariaDB Server Copyright (c) <span>2000</span>, <span>2015</span>, Oracle, MariaDB Corporation Ab <span>and</span> others. Type 'help;' <span>or</span> '\h' <span>for</span> help. Type '\c' <span>to</span> clear <span>the</span> current input statement. MariaDB [(none)]> select user, host, password <span>from</span> mysql.user; <span>#检索数据库用户</span> +<span>------+--------------+----------+</span> | user | host | password | +<span>------+--------------+----------+</span> | root | localhost | | | root | rachel | | | root | <span>127.0</span><span>.0</span><span>.1</span> | | | root | ::<span>1</span> | | | | localhost | | | | rachel | | +<span>------+--------------+----------+</span><span>6</span> rows <span>in</span><span>set</span> (<span>0.00</span> sec) MariaDB [(none)]> delete <span>from</span> mysql.user <span>where</span> user=''; Query OK, <span>2</span> rows affected (<span>0.00</span> sec) <span>#删除匿名用户</span>MariaDB [(none)]> delete <span>from</span> mysql.user <span>where</span> user='root' <span>and</span> host='::<span>1</span>'; <span>#删除IPv6方式登录用户</span> Query OK, <span>1</span> row affected (<span>0.00</span> sec) MariaDB [(none)]> select user, host, password <span>from</span> mysql.user; <span>#再次查看用户</span> +<span>------+--------------+----------+</span> | user | host | password | +<span>------+--------------+----------+</span> | root | localhost | | | root | rachel | | | root | <span>127.0</span><span>.0</span><span>.1</span> | | +<span>------+--------------+----------+</span><span>3</span> rows <span>in</span><span>set</span> (<span>0.00</span> sec) MariaDB [(none)]> <span>set</span> password <span>for</span> root@localhost=password('XXXXXX'); <span>#修改本地登录密码</span> Query OK, <span>0</span> rows affected (<span>0.00</span> sec) MariaDB [(none)]> <span>set</span> password <span>for</span> root@rachel=password('XXXXXX'); <span>#修改本地登录密码</span> Query OK, <span>0</span> rows affected (<span>0.00</span> sec) MariaDB [(none)]> <span>set</span> password <span>for</span> root@'<span>127.0</span><span>.0</span><span>.1</span>'=password('XXXXXX'); <span>#修改本地登录密码</span> Query OK, <span>0</span> rows affected (<span>0.00</span> sec) MariaDB [(none)]> select user, host, password <span>from</span> mysql.user; <span>#查看密码</span> +<span>------+--------------+-------------------------------------------+</span> | user | host | password | +<span>------+--------------+-------------------------------------------+</span> | root | localhost | *<span>1728</span>FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX | | root | rachel | *<span>1728</span>FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX | | root | <span>127.0</span><span>.0</span><span>.1</span> | *<span>1728</span>FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX | +<span>------+--------------+-------------------------------------------+</span><span>3</span> rows <span>in</span><span>set</span> (<span>0.00</span> sec) MariaDB [(none)]> <span>exit</span><span>#退出</span> Bye [root@rachel ~]<span># mysql -u root -p #再次用密码登录测试</span> Enter password: Welcome <span>to</span><span>the</span> MariaDB monitor. Commands <span>end</span><span>with</span> ; <span>or</span> \g. Your MariaDB connection <span>id</span><span>is</span><span>4</span> Server <span>version</span>: <span>5.5</span><span>.44</span>-MariaDB MariaDB Server Copyright (c) <span>2000</span>, <span>2015</span>, Oracle, MariaDB Corporation Ab <span>and</span> others. Type 'help;' <span>or</span> '\h' <span>for</span> help. Type '\c' <span>to</span> clear <span>the</span> current input statement. MariaDB [(none)]> <span>exit</span> Bye [root@rachel ~]<span># #测试成功</span></code>
The above introduces the installation of Apache+PHP+MariaDB on CentOS7, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.