<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Plesk Obsidian &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/plesk-obsidian/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Fri, 21 Jun 2024 17:50:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>Plesk Obsidian &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>cloudinit breaks connections from localhost to Plesk-operated web servers</title>
		<link>https://wadetregaskis.com/cloudinit-breaks-connections-from-localhost-to-plesk-operated-web-servers/</link>
					<comments>https://wadetregaskis.com/cloudinit-breaks-connections-from-localhost-to-plesk-operated-web-servers/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 23 Jan 2024 01:03:08 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Broken Link Checker]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[cloud-init]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Plesk Obsidian]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://wadetregaskis.com/?p=7491</guid>

					<description><![CDATA[I don&#8217;t know how or why it is even installed &#8211; perhaps part of the provided Ubuntu image from my VPS host &#8211; but cloud-init (a.k.a &#8220;cloud-config&#8221;) is a bit obnoxious. At [re]boot time (best I can tell), it resets /etc/hosts based on some random template it has (/etc/cloud/templates/hosts.debian.tmpl in my case, even though that&#8230; <a class="read-more-link" href="https://wadetregaskis.com/cloudinit-breaks-connections-from-localhost-to-plesk-operated-web-servers/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>I don&#8217;t know how or why it is even installed &#8211; perhaps part of the provided Ubuntu image from my VPS host &#8211; but <a href="https://github.com/canonical/cloud-init" data-wpel-link="external" target="_blank" rel="external noopener">cloud-init</a> (a.k.a &#8220;cloud-config&#8221;) is a bit obnoxious.  At [re]boot time (best I can tell), it resets <code>/etc/hosts</code> based on some random template it has (<code>/etc/cloud/templates/hosts.debian.tmpl</code> in my case, even though that makes no sense as I&#8217;m not using Debian).  That template has a very weird entry:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><code>127.0.1.1 {{fqdn}} {{hostname}}</code></p>
</blockquote>



<p>I have no idea what it&#8217;s even trying to do with that.</p>



<p>What it <em>does</em> do is break a lot of things, because while 127.0.1.1 is a valid address (albeit weird to use instead of the canonical 127.0.0.1), in a standard <a href="https://www.plesk.com" data-wpel-link="external" target="_blank" rel="external noopener">Plesk</a> system <a href="https://nginx.org" data-wpel-link="external" target="_blank" rel="external noopener">Nginx</a> (that sits in front of <a href="https://httpd.apache.org" data-wpel-link="external" target="_blank" rel="external noopener">Apache</a> typically) is configured to listen only on the network interface(s) associated with your web server&#8217;s public IP address(es), not localhost<sup data-fn="f02da440-1755-49a0-b849-7989472e1805" class="fn"><a href="#f02da440-1755-49a0-b849-7989472e1805" id="f02da440-1755-49a0-b849-7989472e1805-link">1</a></sup>.  So if you try e.g. <code>curl mydomain.com</code> from inside your server hosting that very domain, you get a connection refused error (or it just times out with no response, depending on firewall settings).</p>



<p>The way <a href="https://talk.plesk.com/threads/can-no-longer-connect-to-nginx-from-localhost.372659/" data-wpel-link="external" target="_blank" rel="external noopener">I found out about this</a> was when WordPress&#8217;s &#8220;cron&#8221; system silently stopped running tasks (because I use a real cron job to trigger it periodically, rather than relying on WordPress&#8217;s flaky built-in system).  I subsequently also noticed that <a href="https://wordpress.org/plugins/broken-link-checker/" data-wpel-link="external" target="_blank" rel="external noopener">Broken Link Checker</a> mistakenly reported <em>every</em> link within my own site as broken.</p>



<h2 class="wp-block-heading">The solution</h2>



<p>…is fairly simple &#8211; modify the template to remove the offending line.  You then have to either reboot or similarly manually modify <code>/etc/hosts</code> to actually apply the fix.</p>



<p>If for some reason you cannot do that, there are potentially workarounds.  For example, for <code>curl</code> commands you can make <code>curl</code> navigate around the problem this like:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>curl --header 'Host: mydomain.com' https://&lt;your server's external IP></code></p></blockquote></figure>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>☝️ If you have a CDN or similar in front of your server, e.g. <a href="https://www.cloudflare.com/" data-wpel-link="external" target="_blank" rel="external noopener">Cloudflare</a>, this will potentially behave differently to connecting from another host; it&#8217;ll bypass the CDN and connect directly to your web server (effectively the same as if you did connect to 127.0.0.1).</p>



<p>Depending on your needs, this could be desirable (e.g. no need to send WordPress cron invocations through a CDN) or undesirable (broken link checking probably should go through the CDN, just like all real traffic, to test that the CDN doesn&#8217;t cause a problem).</p>
</div></div>



<p>In a non-Plesk environment you might also be able to just change the Nginx configuration (somewhere under <code>/etc/nginx</code>).  That&#8217;s ill-advised for Plesk-operated servers as Plesk will inevitably revert your changes (and as far as I can tell there is no configuration option, or workaround otherwise, to make Plesk configure Nginx to listen on localhost as well 😕).</p>


<ol class="wp-block-footnotes"><li id="f02da440-1755-49a0-b849-7989472e1805">I suspect this is more a side-effect than intentional.  Plesk chooses the interface only implicitly, when it specifies that it listens on specific addresses &#8211; those assigned to the website in question (Nginx can host multiple otherwise unrelated websites, and each is configured independently within its settings).  Since Plesk supports hosting multiple websites, each with potentially <em>different</em> IP addresses, it makes sense that it would want to keep them separate.  Otherwise, in a shared hosting situation you could connect to the IP address for somehost.com yet issue a HTTP request for unrelatedhost.com and actually get a response, which is weird, at least. <a href="#f02da440-1755-49a0-b849-7989472e1805-link" aria-label="Jump to footnote reference 1">↩︎</a></li></ol>]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/cloudinit-breaks-connections-from-localhost-to-plesk-operated-web-servers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7491</post-id>	</item>
		<item>
		<title>How to install ImageMagick 7 for WordPress under Plesk Obsidian on Ubuntu 22.04</title>
		<link>https://wadetregaskis.com/how-to-install-imagemagick-7-for-wordpress-under-plesk-obsidian-on-ubuntu-22-04/</link>
					<comments>https://wadetregaskis.com/how-to-install-imagemagick-7-for-wordpress-under-plesk-obsidian-on-ubuntu-22-04/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Mon, 22 Jan 2024 02:29:08 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[AVIF]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Imagick]]></category>
		<category><![CDATA[JXL]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Plesk Obsidian]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://wadetregaskis.com/?p=7457</guid>

					<description><![CDATA[Why should I do this? WordPress relies on either ImageMagick or GD for its ability to read &#38; write images. It prefers ImageMagick, as ImageMagick supports a much wider range of files, tends to be faster, and some assert that it produces higher quality files. ImageMagick 6 was superseded by ImageMagick 7 nearly a decade&#8230; <a class="read-more-link" href="https://wadetregaskis.com/how-to-install-imagemagick-7-for-wordpress-under-plesk-obsidian-on-ubuntu-22-04/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading no-clear-thanks">Why should I do this?</h2>



<p><a href="https://wordpress.org" data-wpel-link="external" target="_blank" rel="external noopener">WordPress</a> relies on either <a href="https://imagemagick.org" data-wpel-link="external" target="_blank" rel="external noopener">ImageMagick</a> or <a href="https://libgd.github.io" data-wpel-link="external" target="_blank" rel="external noopener">GD</a> for its ability to read &amp; write images.  It prefers ImageMagick, as ImageMagick supports a much wider range of files, tends to be faster, and some assert that it produces higher quality files.</p>



<p>ImageMagick 6 was superseded by ImageMagick 7 nearly a decade ago.  <a href="https://legacy.imagemagick.org" data-wpel-link="external" target="_blank" rel="external noopener">Version 6 is officially in legacy mode</a> and while still technically supported (in a <a href="https://en.wikipedia.org/wiki/Long-term_support" data-wpel-link="external" target="_blank" rel="external noopener">long term support</a> sense) it generally receives only bug fixes &#8211; it fundamentally lacks many features, and most crucially it doesn&#8217;t support modern image formats correctly, such as AVIF<sup data-fn="39baf781-8a25-40c7-8128-a093b1008184" class="fn"><a href="#39baf781-8a25-40c7-8128-a093b1008184" id="39baf781-8a25-40c7-8128-a093b1008184-link">1</a></sup>.</p>



<p>Additionally, <a href="https://www.cvedetails.com/vulnerability-list/vendor_id-1749/Imagemagick.html?page=1&amp;cvssscoremin=9&amp;order=7&amp;trc=646&amp;sha=65fdcf32523abd445121e3eeede4072f9b2e0164" data-wpel-link="external" target="_blank" rel="external noopener">ImageMagick is a common source of serious security exploits</a>.  It&#8217;s very important to run the latest version (or very close to) at all times, to have as many critical bug fixes as possible.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>I recall when I was at Google there was &#8211; very begrudging &#8211; use of ImageMagick &#8211; it <em>is</em> the premier library for converting images when you really need to accept just about anything &#8211; but there were heroic efforts taken to isolate it and compartmentalise it, because it was taken as a given that it would be successfully exploited all the time<sup data-fn="dd7bbb45-83b3-427f-b78e-2e7899711d0f" class="fn"><a href="#dd7bbb45-83b3-427f-b78e-2e7899711d0f" id="dd7bbb45-83b3-427f-b78e-2e7899711d0f-link">2</a></sup>.  Buffer overflows, memory corruption, etc &#8211; ImageMagick is written in plain old C &amp; C++, and as such is inherently very prone to these kinds of problems.</p>
</div></div>



<p>Note that, depending on how you operate your WordPress site(s), you may or may not be seriously exposed to ImageMagick security problems.  For simple single-author sites, where only the admin can upload anything to the site (images or otherwise), it&#8217;s arguably not a huge concern.  But for more complex sites with multiple contributors &#8211; or worse, sites which accept images from general users or the public &#8211; using an outdated ImageMagick release is a serious risk.</p>



<h2 class="wp-block-heading">Why isn&#8217;t this easy?</h2>



<p>On some Linux distros, and when Plesk isn&#8217;t involved, it <em>is</em> easy &#8211; you just <code>apt install imagemagick</code> or <code>yum install ImageMagick</code> or at worst <a href="https://imagemagick.org/script/download.php" data-wpel-link="external" target="_blank" rel="external noopener">download the RPM</a> and install that.  Generally that installs ImageMagick 7 (and if not the very latest release, at least a recent one).  You subsequently just run <code>update</code> on your package manager periodically and ImageMagick is kept reasonably up to date.</p>



<p>Ubuntu does not like ImageMagick 7, for some reason.  No version of Ubuntu supports it officially, in the sense that it is not in any of the official package repos.  If you <code>apt install imagemagick</code>, you&#8217;ll get version 6 &#8211; and not even a recent version 6, but 6.9.11-60 which is over three years old!  That&#8217;s <em>three years</em> of well-known bugs &#8211; some of them potential security exploits.</p>



<p>So, unfortunately, the only way to install a modern version of ImageMagick on Ubuntu is manually.</p>



<p>Consequently, you have to manually install a suitable version of <a href="https://github.com/Imagick/imagick" data-wpel-link="external" target="_blank" rel="external noopener">Imagick</a> as well, and you have to do it into Plesk&#8217;s special PHP installation(s).</p>



<p>It took me several hours to figure all of this out, which is why I&#8217;ve written this post &#8211; so that nobody else ever has to.</p>



<h2 class="wp-block-heading">The procedure</h2>



<p>If you run into any issues, please let me know in the comments section at the bottom of the page.  I endeavour to correct any mistakes, oversights, or confusion.</p>



<p>Note that most of these commands must be run as <em>root</em>.  Either run them inside a root shell (e.g. <code>su</code>, or <code>sudo bash</code>) or prefix them with <code>sudo</code>.</p>



<h3 class="wp-block-heading">Install ImageMagick 7</h3>



<p>Fortunately, <a href="https://github.com/SoftCreatR/imei" data-wpel-link="external" target="_blank" rel="external noopener">ImageMagick Easy Install (IMEI)</a> exists to greatly simplify this step.</p>



<p>First, as a precaution IMEI insists you remove any existing ImageMagick installation(s).  Manually installing a build of ImageMagick over the formally-packaged Ubuntu version could cause problems.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<div class="wp-block-group warning is-horizontal is-content-justification-center is-layout-flex wp-container-core-group-is-layout-00ace616 wp-block-group-is-layout-flex">
<p style="font-size:100px">⚠️</p>



<p class="wp-container-content-9cfa9a5a">Be mindful that as soon as you run this command, things on your server that rely on ImageMagick will no longer work!  Fortunately this whole process takes less than half an hour, so it might go unnoticed (WordPress itself will continue working fine, serving up all existing media, but you probably won&#8217;t be able to upload new images until you finish this procedure).<br><br>If you do not finish the installation successfully, your server will likely be left in a bad, partly-broken state.  In principle you can revert back to the standard system versions of things, with e.g. <code>apt install imagemagick</code> or perhaps through Plesk, but I haven&#8217;t tested it and I make no promises.</p>
</div>
</div></div>



<figure class="wp-block-pullquote"><blockquote><p><code>apt remove "*imagemagick*" --purge -y &amp;&amp; apt autoremove --purge -y</code></p></blockquote></figure>



<p>Next, download and install ImageMagick:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>pushd /tmp &amp;&amp; git clone https://github.com/SoftCreatR/imei &amp;&amp; cd imei &amp;&amp; chmod +x imei.sh &amp;&amp; ./imei.sh</code></p></blockquote></figure>



<p>By default it&#8217;ll install a very recent version &#8211; usually the very latest release &#8211; but you can customise it if you wish with the <code>--imagemagick-version</code> argument to <code>imei.sh</code>.</p>



<p>Note: I had to use the <code>--force</code> argument to get <code>imei.sh</code> to actually build &amp; install <em>all</em> the components &#8211; for some reason it skipped the dependent libraries (for AVIF &amp; JXL support) and just installed ImageMagick, <em>without</em> AVIF and JXL support.  Try it without first, since that&#8217;s supposed to be the happy path, but check that it says <code>[<span style="color: green">OK</span>]</code> for every item; that nothing is <code>[<span style="color: green">SKIPPED</span>]</code>.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>Building libaom (for AVIF support) requires CMake 3.6 or later.  Ubuntu 22.04 comes with a suitable version, so you shouldn&#8217;t have any issues.  But if you&#8217;re installing on an older Ubuntu, a different distro, or you&#8217;ve messed with CMake otherwise, check that you have a suitable version with <code>cmake --version</code>.</p>
</div></div>



<p>Once it&#8217;s completed successfully &#8211; which can take tens of minutes if you have a wimpy server such as is often used for WordPress hosting &#8211; double-check that you have a good version installed:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>identify --version</code></p></blockquote></figure>



<p>At time of writing that says 7.1.1-26 for me, but of course for you it&#8217;ll probably be something newer.  You can consult <a href="https://imagemagick.org/script/download.php" data-wpel-link="external" target="_blank" rel="external noopener">ImageMagick&#8217;s download page</a> to find out what the newest version is.</p>



<h3 class="wp-block-heading">Install Imagick</h3>



<p>First, download Imagick:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>pushd /tmp &amp;&amp; git clone https://github.com/Imagick/imagick &amp;&amp; cd imagick</code></p></blockquote></figure>



<p>Next, you need to set the version string to the actual version &#8211; otherwise, at the very end of this process, you&#8217;ll find that WordPress quietly refuses to use ImageMagick / Imagick!  Do that by editing the <code>php_imagick.h</code> file.  You should see, somewhere near the top of the file, something like:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #AF00DB">#define</span><span style="color: #0000FF"> PHP_IMAGICK_VERSION    </span><span style="color: #A31515">&quot;@PACKAGE_VERSION@&quot;</span></span>
<span class="line"><span style="color: #AF00DB">#define</span><span style="color: #0000FF"> PHP_IMAGICK_EXTNUM     </span><span style="color: #098658">30700</span></span></code></pre></div>



<p>You need to change that first string to the version declared on that second line.  30700 means version 3.7.0.  So in my case I replaced <code>"@PACKAGE_VERSION@"</code> with <code>"3.7.0"</code>.</p>



<p>Now you need to determine where the relevant PHP installation is &#8211; the version that Plesk is using to run WordPress for your website(s).  You can find that out in various ways, perhaps the simplest being to log in to your Plesk dashboard, open the &#8220;Websites &amp; Domains&#8221; section, and look at the PHP version listed for each website of interest.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>☝️If you have multiple sites and they&#8217;re not all running the same version of PHP, you&#8217;ll need to repeat all the following steps for each PHP version.</p>
</div></div>



<p>In my case I&#8217;m using PHP 8.2. So now I know that the PHP install of interest is located at <code>/opt/plesk/php/8.2/</code> (Plesk installs all its versions of PHP in <code>/opt/plesk/php</code>). I&#8217;ll use that in the subsequent commands shown here, but make sure to adjust that to suit whatever version of PHP you&#8217;re using.</p>



<p>To build Imagick, you need the PHP developer tools &#8211; for your particular Plesk PHP installation(s).  e.g. in my case I&#8217;m using PHP 8.2, so I need to run:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>apt install plesk-php82-dev</code></p></blockquote></figure>



<p>Now you need to configure the Imagick build:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>/opt/plesk/php/8.2/bin/phpize &amp;&amp; ./configure --prefix=/opt/plesk/php/8.2/ --exec-prefix=/opt/plesk/php/8.2/ --datadir=/opt/plesk/php/8.2/ --with-php-config=/opt/plesk/php/8.2/bin/php-config &amp;&amp; make -j `nproc --all` install</code></p></blockquote></figure>



<p>Don&#8217;t forget to change &#8220;8.2&#8221; to your version of PHP, if it&#8217;s different!</p>



<p>It should only take ten seconds or so to configure, build, &amp; install Imagick.</p>



<p>Now, rename the built library so that Plesk updates won&#8217;t clobber it:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>mv /opt/plesk/php/8.2/lib/php/modules/imagick{,_custom}.so</code></p></blockquote></figure>



<p>Lastly, although it&#8217;s technically optional, it&#8217;s nice to fix the permissions of the installed library:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>chmod 644 /opt/plesk/php/8.2/lib/php/modules/imagick_custom.so</code></p></blockquote></figure>



<h3 class="wp-block-heading">Load Imagick into PHP</h3>



<p>Annoyingly, PHP won&#8217;t automatically notice Imagick is installed &#8211; you have to tell it so, manually.  Though this is pretty easy to do.  There are a few ways to do it, the easiest being through Plesk:  go to the &#8220;Tools &amp; Settings&#8221; section of your Plesk dashboard, click &#8220;PHP Settings&#8221; (from the &#8220;General Settings&#8221; category), then click on the relevant handler in the list (e.g. &#8220;FPM application&#8221;).  If you&#8217;re not sure which is relevant, look for a non-zero number in the &#8220;Domains&#8221; column.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>☝️If you use different handlers for different websites &#8211; as will be shown in the &#8220;Domains&#8221; column by a number greater than zero for multiple rows &#8211; then you might need to repeat the following steps for each one of them.  Start with any one of them, then when editing the <code>php.ini</code> file (as explained below) check which handlers are listed as also covered by that same file.  If any are missing, those are the ones you&#8217;ll need to repeat these steps on.</p>
</div></div>



<p>Click on &#8220;php.ini&#8221; to switch to that tab, and you should see a text field containing the contents of the relevant <code>php.ini</code> file.  Somewhere in this file &#8211; technically anywhere, but I like to scroll down to the section where all the other extensions are listed &#8211; you need to add the line:</p>



<pre class="wp-block-preformatted">extension=imagick_custom.so</pre>



<p>Then, click the &#8220;OK&#8221; button to save your changes.</p>



<p>In <em>theory</em> Plesk will now restart the relevant server daemons, to have them pick up the change, but if you subsequently find that WordPress doesn&#8217;t seem to see the new ImageMagick installation (or you edited <code>php.ini</code> directly from the command line), you can give it a more forceful shove:</p>



<figure class="wp-block-pullquote"><blockquote><p><code>service plesk-php82-fpm restart</code></p></blockquote></figure>



<p>You should now be set &#8211; you can test your upgrade in a variety of ways, such as:</p>



<ul class="wp-block-list">
<li>Try uploading an image in a format, or using features such as animation or transparency, that wasn&#8217;t previously supported.  e.g. AVIFs.  Note that you might need additional WordPress plug-ins to enable use of the new formats, e.g. <a href="https://wordpress.org/plugins/avif-support/" data-wpel-link="external" target="_blank" rel="external noopener">AVIF Support</a> or any of the <a href="https://wordpress.org/plugins/search/svg/" data-wpel-link="external" target="_blank" rel="external noopener">numerous SVG support plug-ins</a>.<br><br>See also <a href="https://wadetregaskis.com/image-workflow-for-wordpress/" data-wpel-link="internal">my earlier post on my Image workflow for WordPress</a> &#8211; particularly <a href="https://wadetregaskis.com/image-workflow-for-wordpress/#AVIF_Support" data-wpel-link="internal">the section on AVIF</a>.</li>



<li>Check phpinfo &#8211; in your Plesk dashboard, go to your website(s) in the &#8220;Websites &amp; Domains&#8221; section, click &#8220;PHP&#8221; (under the &#8220;Dev Tools&#8221; category), then click the subtle &#8220;View the phpinfo() page&#8221; link to the right of the first pop-up menus.  Search for &#8220;imagick&#8221; &#8211; you should find an entry for it, with a table of plug-in information such as its version, the version of ImageMagick being used, and the file formats supported.</li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="946" height="480" src="https://wadetregaskis.com/wp-content/uploads/2024/01/imagick-section-of-phpinfo.webp" alt="Screenshot of the &quot;imagick&quot; section of the phpinfo page." class="wp-image-7465" srcset="https://wadetregaskis.com/wp-content/uploads/2024/01/imagick-section-of-phpinfo.webp 946w, https://wadetregaskis.com/wp-content/uploads/2024/01/imagick-section-of-phpinfo-256x130.webp 256w, https://wadetregaskis.com/wp-content/uploads/2024/01/imagick-section-of-phpinfo-512x260.webp 512w, https://wadetregaskis.com/wp-content/uploads/2024/01/imagick-section-of-phpinfo@2x.webp 1892w" sizes="(max-width: 946px) 100vw, 946px" /></figure>
</div>


<h2 class="wp-block-heading">Addendum: updating ImageMagick &amp; Magick</h2>



<p>You can of course just repeat all the above steps to perform a fresh install, incorporating any updates since you last installed everything.  But you can save a little time by keeping the <code>imei</code> and <code>imagick</code> folders around, and just doing:</p>



<ol class="wp-block-list">
<li><code>git pull --rebase</code> in each, then re-run their respective build commands.  For Imagick you&#8217;ll probably have to <code>git stash</code> first, in order to do the <code>git pull</code>, and then restore your version string patch with <code>git stash apply</code>.<br><br>Don&#8217;t forget to check if you need to update the version string in <code>php_imagick.h</code>.</li>



<li>Rename the built <code>imagick.so</code> again, and fix its permissions.</li>



<li>Restart the PHP daemon.</li>
</ol>


<ol class="wp-block-footnotes"><li id="39baf781-8a25-40c7-8128-a093b1008184">Some versions &amp; builds nominally support AVIF, but this support is almost by accident &#8211; what they actually support formally is <a href="https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format" data-wpel-link="external" target="_blank" rel="external noopener">HEIF</a>, for which they use <a href="https://github.com/strukturag/libheif" data-wpel-link="external" target="_blank" rel="external noopener">libheif</a>, which <em>can</em> be built with AVIF support as well, but in my experience that support is buggy and incomplete &#8211; e.g. <a href="https://alexwlchan.net/2023/check-for-transparency/" data-wpel-link="external" target="_blank" rel="external noopener">alpha channels are not supported</a>. <a href="#39baf781-8a25-40c7-8128-a093b1008184-link" aria-label="Jump to footnote reference 1">↩︎</a></li><li id="dd7bbb45-83b3-427f-b78e-2e7899711d0f">Alas I don&#8217;t actually know if / how often it was successfully exploited, as far as Google saw.  I have to imagine it was not uncommon, though, given the large attack surface that is ImageMagick&#8217;s APIs and image plug-ins, not to mention how lucrative a target Google is. <a href="#dd7bbb45-83b3-427f-b78e-2e7899711d0f-link" aria-label="Jump to footnote reference 2">↩︎</a></li></ol>]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/how-to-install-imagemagick-7-for-wordpress-under-plesk-obsidian-on-ubuntu-22-04/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			<media:content url="https://wadetregaskis.com/wp-content/uploads/2024/01/ImageMagick-logo.avif" medium="image" />
<post-id xmlns="com-wordpress:feed-additions:1">7457</post-id>	</item>
	</channel>
</rss>
