如何部署WordPress for Oracle Linux 9.x php-8.1.x ?

WordPress

1基础环境配置

1.1 最新版本的PHP编译安装

如何基于Oracle Linux 9.x编译安装PHP-FPM 8.x?


需要注意的是,为了避免如下提示,

Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib64/extensions/no-debug-zts-20230831/mysqli (/usr/lib64/extensions/no-debug-zts-20230831/mysqli: cannot open shared object file: No such file or directory), /usr/lib64/extensions/no-debug-zts-20230831/mysqli.so (/usr/lib64/extensions/no-debug-zts-20230831/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0

或如下提示,

PHP OpenSSL or mcrypt module required
The All In One WP Security plugin's Two Factor Authentication module requires either the PHP openssl (preferred) or mcrypt module to be installed. Please ask your web hosting company to install one of them.

或如下提示,

2024/08/06 13:52:11 [error] 238454#238454: *186644 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function WpOrg
\Requests\gzinflate() in /var/www/www.cmdschool.org/wp-includes/Requests/src/Requests.php:1085
Stack trace:
#0 /var/www/www.cmdschool.org/wp-includes/Requests/src/Requests.php(1021): WpOrg\Requests\Requests::compatible_gzinflate('U\xC9A\n\x80 \x10\x05\xD0\xBB\xCC
:\\H\x10...')
#1 /var/www/www.cmdschool.org/wp-includes/Requests/src/Requests.php(951): WpOrg\Requests\Requests::compatible_gzinflate('\x1F\x8B\x08\x00\x00\x00\x00\x00\x
00\x03U\xC9A\n\x80...')
#2 /var/www/www.cmdschool.org/wp-includes/Requests/src/Requests.php(777): WpOrg\Requests\Requests::decompress('\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03U\xC
9A\n\x80...')
#3 /var/www/www.cmdschool.org/wp-includes/Requests/src/Requests.php(473): WpOrg\Requests\Requests::parse_response(Array, 'http://api.word...', Array, NULL,
 Array)
#4 /var/www/www.cmdschool.org/wp-includes/class-wp-http.php(397): WpOrg\Requests\Requests::request('http://api.word...', Array, NULL, 'GET', Arra" while re
ading response header from upstream, client: 59.148.201.167, server: www.cmdschool.org, request: "GET /wp-admin/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:
9000", host: "www.cmdschool.org", referrer: "https://www.cmdschool.org/archives/25240"

你可以需要把一些模块编译进去,而不是以插件的方式安装,

cd ~/php-8.1.28
./configure --bindir=/usr/bin/ \
--sbindir=/usr/sbin/ \
--sysconfdir=/etc/ \
--libdir=/usr/lib64/ \
--mandir=/usr/share/man/ \
--includedir=/usr/include/ \
--with-config-file-path=/etc/php.ini \
--with-config-file-scan-dir=/etc/php.d/ \
--with-fpm-user=apache \
--with-fpm-group=apache \
--enable-fpm \
--with-fpm-systemd \
--with-libdir=lib64 \
--enable-zts \
--enable-static \
--enable-shared \
--with-mysqli \
--with-zlib \
--with-openssl

1.2 安装Nginx

1.2.1 配置安装源

vim /etc/yum.repos.d/nginx.repo 

加入如下配置,

[nginx]
name=nginx
baseurl=http://nginx.org/packages/rhel/9/x86_64/
enabled=1
gpgcheck=0

1.2.2 安装软件包

dnf install -y nginx

2 部署WordPress

2.1 加载模块

2.1.1 加载curl模块

cd ~/php-8.1.28/ext/curl
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=curl' > /etc/php.d/curl.ini
systemctl reload php-fpm

如果遇到如下错误提示,

configure: error: Package requirements (libcurl >= 7.29.0) were not met:

Package 'libcurl', required by 'virtual:world', not found

可通过如下命令解决依赖关系,

dnf install -y libcurl-devel

2.1.2 加载exif模块

cd ~/php-8.1.28/ext/exif
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=exif' > /etc/php.d/exif.ini
systemctl reload php-fpm

2.1.3 加载mbstring模块

cd ~/php-8.1.28/ext/mbstring
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=mbstring' > /etc/php.d/mbstring.ini
systemctl reload php-fpm

如果遇到如下错误,

configure: error: Package requirements (oniguruma) were not met:

Package 'oniguruma', required by 'virtual:world', not found

可通过如下命令解决依赖关系,

dnf install -y oniguruma-devel

2.1.4 加载gd模块

cd ~/php-8.1.28/ext/gd
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=gd' > /etc/php.d/gd.ini
systemctl reload php-fpm

2.1.5 加载sockets模块

cd ~/php-8.1.28/ext/sockets
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=sockets' > /etc/php.d/sockets.ini
systemctl reload php-fpm

2.1.6 加载zip模块

cd ~/php-8.1.28/ext/zip/
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=zip' > /etc/php.d/zip.ini
systemctl reload php-fpm

如果遇到如下错误提示,

configure: error: Package requirements (libzip >= 0.11) were not met:
No package 'libzip' found

可参阅如下章节解决此依赖关系,

如何编译安装libzip?

2.1.7 加载imagick模块

cd ~
wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar -xf imagick-3.7.0.tgz
cd ~/imagick-3.7.0/
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=imagick' > /etc/php.d/imagick.ini
systemctl reload php-fpm

可参阅如下章节解决此依赖关系,

dnf install -y ImageMagick-devel

2.2 部署WordPress

2.2.1 下载安装包

cd~
wget https://wordpress.org/wordpress-6.6.1.tar.gz -O wordpress-6.6.1.tar.gz

注:最新版本的下载地址请参阅,
https://wordpress.org/download/

2.2.2 部署安装包

tar -xf wordpress-6.6.1.tar.gz
mv wordpress/* /var/www/www.cmdschool.org/
chown apache:apache -R /var/www/www.cmdschool.org/
chmod 775 -R /var/www/www.cmdschool.org/

2.2.3 部署数据库

mysql -uroot -p
create database wordpress character set utf8;
grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'wordpresspwd';
grant all privileges on wordpress.* to 'wordpress'@'127.0.0.1' identified by 'wordpresspwd';
flush privileges;

2.2.4 登录并根据向导连接数据库

O(∩_∩)O哈哈〜,界面操作自己领悟哈!

没有评论

发表回复

WordPress
如何安装配置WordPress的wp-cli?

1 前言 一个问题,一篇文章,一出故事。 最近遇到WordPress迁移之后出入如下错误,因此,我们 …

WordPress
如何部署WordPress for Oracle Linux 9.x php-8.2.x ?

1基础环境配置 1.1 最新版本的PHP编译安装 如何基于Oracle Linux 9.x编译安装P …

WordPress
如何部署WordPress for Oracle Linux 9.x php-8.3.x ?

1基础环境配置 1.1 最新版本的PHP编译安装 如何基于Oracle Linux 9.x编译安装P …