PHP
安装相关包,依赖EPEL源
yum -y install gcc openssl-devel libxml2-devel bzip2-devel libmcrypt-develsqlite-devel oniguruma-devel
获取源码,并解压yum install sqlite-develyum -y install autoconf automake libtoolwget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gztar -zxf oniguruma-6.9.4.tar.gzcd oniguruma-6.9.4编译安装./autogen.sh && ./configure --prefix=/usrmake && make install
编译安装
tar xvf php-7.4.3.tar.xzcd php-7.4.3/./configure \--prefix=/apps/php \--enable-mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-openssl \--with-zlib \--with-config-file-path=/etc \--with-config-file-scan-dir=/etc/php.d \--enable-mbstring \--enable-xml \--enable-sockets \--enable-fpm \--enable-maintainer-zts \--disable-fileinfomake && make install
[root@han ~]# vim /etc/profile.d/lamp.shPATH=/apps/php74/bin:/apps/httpd/bin:$PATH. /etc/profile.d/lamp.sh[root@han ~]# php --versionPHP 7.4.3 (cli) (built: Mar 7 2021 19:27:29) ( ZTS )Copyright (c) The PHP GroupZend Engine v3.4.0, Copyright (c) Zend Technologies
准备php配置文件和启动文件
cp php.ini-production /etc/php.inicp sapi/fpm/php-fpm.service /usr/lib/systemd/system/cd /apps/php74/etccp php-fpm.conf.default php-fpm.confcd php-fpm.d/cp www.conf.default www.conf
修改进程所有者
vim /apps/php/etc/php-fpm.d/www.confuser apachegroup apache#支持status和ping页面pm.status_path = /fpm_statusping.path = /ping
启动PHP-fpm
systemctl daemon-reloadsystemctl status php-fpm.servicesystemctl enable --now php-fpm.service
web服务
修改配置 httpd 支持 php-fpm
vim /apps/httpd/conf/httpd.conf#取消下面两行的注释LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so#修改下面行<IfModule dir_module>DirectoryIndex index.php index.html</IfModule>#加下面三行AddType application/x-httpd-php .php#AddType application/x-httpd-php-source .phpsProxyRequests 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


