<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>imagick &#8211; 良的世界</title>
	<atom:link href="https://www.lemonary.cn/tag/imagick/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lemonary.cn</link>
	<description></description>
	<lastBuildDate>Thu, 19 Jun 2025 05:38:29 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.lemonary.cn/wp-content/uploads/2024/12/logo-150x150.jpg</url>
	<title>imagick &#8211; 良的世界</title>
	<link>https://www.lemonary.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WordPress站点健康之PHP模组Exif和Imagick</title>
		<link>https://www.lemonary.cn/wordpress%e7%ab%99%e7%82%b9%e5%81%a5%e5%ba%b7%e4%b9%8bphp%e6%a8%a1%e7%bb%84exif%e5%92%8cimagick/</link>
					<comments>https://www.lemonary.cn/wordpress%e7%ab%99%e7%82%b9%e5%81%a5%e5%ba%b7%e4%b9%8bphp%e6%a8%a1%e7%bb%84exif%e5%92%8cimagick/#respond</comments>
		
		<dc:creator><![CDATA[shine]]></dc:creator>
		<pubDate>Thu, 21 Nov 2024 08:55:45 +0000</pubDate>
				<category><![CDATA[建站记录]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://lemonary.cn/?p=375</guid>

					<description><![CDATA[一、问题背景 在 WordPress 配置界面的工具中的站点健康检查出现“缺少一个或多个推荐的模组”，以及“可 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading" id="一、问题背景">一、问题背景</h2>



<p>在 WordPress 配置界面的工具中的站点健康检查出现“缺少一个或多个推荐的模组”，以及“可选的模组exif未被安装或已被禁用”和“可选的模组imagick未被安装或已被禁用”。</p>



<h2 class="wp-block-heading" id="二、Exif和Imagick是什么">二、Exif和Imagick是什么</h2>



<p>由于我没有学过PHP，不太了解这两个模组有什么具体的功能。感兴趣的可以详细去了解一下。</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Exif<br><a href="https://blog.csdn.net/gitblog_00991/article/details/143556269">https://blog.csdn.net/gitblog_00991/article/details/143556269</a><br>Imagick<br><a href="https://blog.csdn.net/gitblog_00047/article/details/139057418">https://blog.csdn.net/gitblog_00047/article/details/139057418</a></p>
</blockquote>



<h2 class="wp-block-heading" id="三、安装配置">三、安装配置</h2>



<h3 class="wp-block-heading" id="3.1-exif">3.1 exif</h3>



<p>由于我的PHP是通过源码安装的，所以我在我的源码包中找到了exif的文件夹，就省去了源码下载的过程。</p>



<p>将模组文件夹<code>exif/</code>拷贝到PHP的ext目录【extend】，我的目录是</p>



<pre class="wp-block-code"><code>/usr/local/php/include/php/ext
# 找不到的话，可以用find命令搜索一下
find / -name "ext"</code></pre>



<p>进入到exif目录，没有configure文件的话，执行phpize</p>



<pre class="wp-block-code"><code>/usr/local/php/bin/phpize</code></pre>



<p>源码安装三部曲</p>



<pre class="wp-block-code"><code>./configure --with-php-config=/usr/local/php/bin/php-config
make
make install</code></pre>



<p>其中<code>/usr/local/php/bin/php-config</code>需要根据自己的环境修改，同理找不到的可以搜索一下。</p>



<p>三部曲执行完成后会在exif目录下的modules目录中生成exif.so文件，将它拷贝到ext目录下。</p>



<h3 class="wp-block-heading" id="3.2-imagick">3.2 imagick</h3>



<p>由于我的PHP源码包中没有找到imagick的包，只能从网上拉取。</p>



<pre class="wp-block-code"><code>wget https://pecl.php.net/get/imagick-3.7.0.tgz</code></pre>



<p>源码包解压</p>



<pre class="wp-block-code"><code>tar -zxvf imagick-3.7.0.tgz</code></pre>



<p>同样进入到imagick目录</p>



<pre class="wp-block-code"><code>cd imagick-3.7.0</code></pre>



<p>如果目录中没有./configure文件，那么可以执行phpize</p>



<pre class="wp-block-code"><code>/usr/local/php/bin/phpize</code></pre>



<p>执行完，configure文件就出现了</p>



<p>源码安装三部曲，此时会发现<code>./configure --with-php-config=/usr/local/php/bin/php-config</code>会报错：</p>



<pre class="wp-block-code"><code>checking ImageMagick MagickWand API configuration program... 
checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... Doesn't exist
checking Testing /usr/sbin/bin/MagickWand-config... Doesn't exist
checking Testing /opt/bin/MagickWand-config... Doesn't exist
checking Testing /opt/local/bin/MagickWand-config... Doesn't exist
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.</code></pre>



<p>原因是PHP的模组依附于ImageMagick而生效，而服务器中并没有安装ImageMagick。故而，需要进行安装。可惜的是我的服务器使用源安装<code>yum install -y ImageMagick-devel</code>并没有找到包，所以还是用源码安装的方式。</p>



<pre class="wp-block-code"><code>wget https://imagemagick.org/archive/ImageMagick.tar.gz</code></pre>



<p>解压源码包</p>



<pre class="wp-block-code"><code>tar -zxvf ImageMagick.tar.gz</code></pre>



<p>再次进入目录</p>



<pre class="wp-block-code"><code>cd ImageMagick-7.1.1-41/</code></pre>



<p>源码安装三部曲</p>



<pre class="wp-block-code"><code>./configure
make
make install</code></pre>



<p>ImageMagick安装完毕后，再回过头来，重新安装imagick，便可成功。</p>



<p>安装成功后同样会在imagick-3.7.0目录下的modules中生成imagick.so文件，将它拷贝到ext目录下。</p>



<h3 class="wp-block-heading" id="3.3-配置PHP">3.3 配置PHP</h3>



<p>编辑<code>php.ini</code>文件，我的路径是<code>/usr/local/php/etc/php.ini</code>，同理找不到的可以搜索一下。</p>



<pre class="wp-block-code"><code>extension_dir = "/usr/local/php/include/php/ext/"
extension=exif.so
extension=imagick.so</code></pre>



<p>保存后退出文件。</p>



<p>重启Web服务器</p>



<pre class="wp-block-code"><code>nginx -s reload</code></pre>



<p>验证模组是否安装成功</p>



<pre class="wp-block-code"><code>&#91;root@dameng etc]# /usr/local/php/bin/php -m
&#91;PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
...
...</code></pre>



<p>此时，回到WordPress配置界面查看站点健康依旧提示两模组未安装，需要重启PHP服务</p>



<pre class="wp-block-code"><code>&#91;root@dameng ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done</code></pre>



<p>至此，再次查看站点健康便没有问题了。</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1024" height="325" src="https://www.lemonary.cn/wp-content/uploads/2024/11/image-299.png" alt="" class="wp-image-2138" srcset="https://www.lemonary.cn/wp-content/uploads/2024/11/image-299.png 1024w, https://www.lemonary.cn/wp-content/uploads/2024/11/image-299-300x95.png 300w, https://www.lemonary.cn/wp-content/uploads/2024/11/image-299-768x244.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>问题解决。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lemonary.cn/wordpress%e7%ab%99%e7%82%b9%e5%81%a5%e5%ba%b7%e4%b9%8bphp%e6%a8%a1%e7%bb%84exif%e5%92%8cimagick/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
