无论是使用LAMP还是LNMP,WordPress对应的PHP扩展都比较多,类似Web Stack环境包都会包含比较全的PHP扩展,如果想只针对WordPress的PHP扩展做优化(最小化安装PHP),可以看官方的Server Environment介绍。
PHP Extensions
WordPress core makes use of PHP extensions. If the preferred extension is missing WordPress will either have to do more work to do the task the module helps with or, in the worst case, will remove functionality. Therefore the PHP extensions listed below are recommended.
curl – Performs remote request operations.
dom – Used to validate Text Widget content and to automatically configuring IIS7+.
exif – Works with metadata stored in images.
fileinfo – Used to detect mimetype of file uploads.
hash – Used for hashing, including passwords and update packages.
json – Used for communications with other servers.
mbstring – Used to properly handle UTF8 text.
mysqli – Connects to MySQL for database interactions.
libsodium – Validates Signatures and provides securely random bytes.
openssl – Permits SSL-based connections to other hosts.
pcre – Increases performance of pattern matching in code searches.
imagick – Provides better image quality for media uploads. See WP_Image_Editor is incoming! for details. Smarter image resizing (for smaller images) and PDF thumbnail support, when Ghost Script is also available.
xml – Used for XML parsing, such as from a third-party site.
zip – Used for decompressing Plugins, Themes, and WordPress update packages.
For the sake of completeness, below is a list of the remaining PHP modules WordPress may use in certain situations or if other modules are unavailable. These are fallbacks or optional and not necessarily needed in an optimal environment, but installing them won’t hurt.
filter – Used for securely filtering user input.
gd – If Imagick isn’t installed, the GD Graphics Library is used as a functionally limited fallback for image manipulation.
iconv – Used to convert between character sets.
mcrypt – Generates random bytes when libsodium and /dev/urandom aren’t available.
simplexml – Used for XML parsing.
xmlreader – Used for XML parsing.
zlib – Gzip compression and decompression.
These extensions are used for file changes, such as updates and plugin/theme installation, when files aren’t writeable on the server.
ssh2
ftp
sockets (For when the ftp extension is unavailable)
The priority of the transports are Direct file IO, SSH2, FTP PHP Extension, FTP implemented with Sockets, and FTP implemented through PHP alone.
总结了下,需要的rpm包:php php-cli php-common php-gd php-mbstring php-mysqlnd php-opcache php-pdo php-pecl-imagick php-pecl-mcrypt php-pecl-ssh2 php-xmlrpc php-pecl-xmlrpc php-pecl-zip php-sodium php-xml php-pecl-xdebug
安装之后可以使用站点健康来进行检测是否有遗漏的。