# yum install mariadb-server mariadb
啟動及設定開機自動執行 MariaDB:
# systemctl start mariadb
# systemctl enable mariadb
安装Apache
# yum install httpd
跟著回答 “y” 後便會完成安裝, 然後輸入以下指令啟動及設定 Apache 開機自動執行:
# systemctl start httpd
# systemctl enable httpd
安裝 PHP 7
下载php7包到/usr/local/src/ 目录并解压
安装扩展包
# yum install gcc libxml2-devel pkgconfig openssl-devel bzip2-devel libpng-devel libpng-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libmcrypt-devel mariadb-devel aspell-devel recode-devel httpd-devel
进入php7解压包
# ./configure \
–prefix=/usr/local/php7/usr \
–with-config-file-path=/usr/local/php7/usr/etc \
–enable-mbstring \
–enable-zip \
–enable-bcmath \
–enable-pcntl \
–enable-ftp \
–enable-exif \
–enable-calendar \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–enable-wddx \
–with-curl \
–with-mcrypt \
–with-iconv \
–with-gmp \
–with-pspell \
–with-gd \
–with-jpeg-dir=/usr \
–with-png-dir=/usr \
–with-zlib-dir=/usr \
–with-xpm-dir=/usr \
–with-freetype-dir=/usr \
–enable-gd-native-ttf \
–enable-gd-jis-conv \
–with-openssl \
–with-pdo-mysql=/usr \
–with-gettext=/usr \
–with-zlib=/usr \
–with-bz2=/usr \
–with-recode=/usr \
–with-mysqli=/usr/bin/mysql_config \
–with-apxs2
然后
#make
#make test
#make install
复制 php.ini-development 文件到 /usr/local/lib 保存为 php.ini
编辑Apache配置文件 /etc/httpd/conf/httpd.conf 加入以下内容
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
保存后重启Apache