如何部署WordPress for Oracle Linux 9.x php-8.3.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

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

cd ~/php-8.3.7
./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

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 加载zlib模块

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

2.1.2 加载curl模块

cd ~/php-8.3.7/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.3 加载openssl模块

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

2.1.4 加载exif模块

cd ~/php-8.3.7/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.5 加载mbstring模块

cd ~/php-8.3.7/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.6 加载gd模块

cd ~/php-8.3.7/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.7 加载sockets模块

cd ~/php-8.3.7/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.8 加载zip模块

cd ~/php-8.3.7/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.9 加载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.1.10 加载imagick模块

cd ~
wget https://pecl.php.net/get/mcrypt-1.0.7.tgz
tar -xf mcrypt-1.0.7.tgz
cd ~/mcrypt-1.0.7/
phpize
./configure
make
make install
rsync -avP /usr/lib64/extensions/no-debug-zts-20230831/ /usr/lib64/php-zts/modules
echo 'extension=mcrypt' > /etc/php.d/mcrypt.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.1.x ?

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