PHP

安装相关包,依赖EPEL源

  1. yum -y install gcc openssl-devel libxml2-devel bzip2-devel libmcrypt-develsqlite-devel oniguruma-devel
  1. 获取源码,并解压
  2. yum install sqlite-devel
  3. yum -y install autoconf automake libtool
  4. wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
  5. tar -zxf oniguruma-6.9.4.tar.gz
  6. cd oniguruma-6.9.4
  7. 编译安装
  8. ./autogen.sh && ./configure --prefix=/usr
  9. make && make install

编译安装

  1. tar xvf php-7.4.3.tar.xz
  2. cd php-7.4.3/
  3. ./configure \
  4. --prefix=/apps/php \
  5. --enable-mysqlnd \
  6. --with-mysqli=mysqlnd \
  7. --with-pdo-mysql=mysqlnd \
  8. --with-openssl \
  9. --with-zlib \
  10. --with-config-file-path=/etc \
  11. --with-config-file-scan-dir=/etc/php.d \
  12. --enable-mbstring \
  13. --enable-xml \
  14. --enable-sockets \
  15. --enable-fpm \
  16. --enable-maintainer-zts \
  17. --disable-fileinfo
  18. make && make install
  1. [root@han ~]# vim /etc/profile.d/lamp.sh
  2. PATH=/apps/php74/bin:/apps/httpd/bin:$PATH
  3. . /etc/profile.d/lamp.sh
  4. [root@han ~]# php --version
  5. PHP 7.4.3 (cli) (built: Mar 7 2021 19:27:29) ( ZTS )
  6. Copyright (c) The PHP Group
  7. Zend Engine v3.4.0, Copyright (c) Zend Technologies

准备php配置文件和启动文件

  1. cp php.ini-production /etc/php.ini
  2. cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
  3. cd /apps/php74/etc
  4. cp php-fpm.conf.default php-fpm.conf
  5. cd php-fpm.d/
  6. cp www.conf.default www.conf

修改进程所有者

  1. vim /apps/php/etc/php-fpm.d/www.conf
  2. user apache
  3. group apache
  4. #支持status和ping页面
  5. pm.status_path = /fpm_status
  6. ping.path = /ping

启动PHP-fpm

  1. systemctl daemon-reload
  2. systemctl status php-fpm.service
  3. systemctl enable --now php-fpm.service

web服务

修改配置 httpd 支持 php-fpm

  1. vim /apps/httpd/conf/httpd.conf
  2. #取消下面两行的注释
  3. LoadModule proxy_module modules/mod_proxy.so
  4. LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
  5. #修改下面行
  6. <IfModule dir_module>
  7. DirectoryIndex index.php index.html
  8. </IfModule>
  9. #加下面三行
  10. AddType application/x-httpd-php .php
  11. #AddType application/x-httpd-php-source .phps
  12. ProxyRequests Off

实现第一个虚拟主机

<virtualhost *:80>
servername www.blog.com
documentroot /data/wordpress
<directory /data/wordpress>
require all granted
</directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/wordpress/$1
#实现status和ping页面
ProxyPassMatch ^/(fpm_status|ping)$ fcgi://127.0.0.1:9000/$1
CustomLog "logs/access_wordpress_log" common
</virtualhost>

准备wordpress和discuz! 相关文件

tar xvf wordpress-5.4.2-zh_CN.tar.gz
mv wordpress/ /data
chown –R apache.apache /data/wordpress


cd /data/wordpress
mv wp-config-sample.php wp-config.php
sed -i.bak -e 's/database_name_here/wordpress/' -e 's/username_here/wordpress/' -e 's/password_here/'''123.com'''/' -e 's/10.0.0.50/127.0.0.1/'  wp-config.php

image.png
image.png