Confirmed. Well done.
So now the question is…why isn’t the preview file created or saved?
I’m still working with HostGator, but this will narrow it down a lot. Looking at the code it is invoking ImageMagick to do a lot of that work. That’s a common library used by lots of tools, so I doubt it is totally broken, but perhaps they did an upgrade that removed PDF support or something? I’ll keep digging on it, but at least we have a way for people to keep working
I can confirm this also avoids the issue for me as well
It seems more likely ImageMagick may be blocked or otherwise restricted by Hostgator, or significantly more people would be seeing this issue. I’m waiting with bated breath to see what HostGator comes back with in your investigation. Many thanks!
Getting closer in the code at least. I’ve added some log statements to this function:
function dol_convert_file($fileinput, $ext = ‘png’, $fileoutput = ‘’, $page = ‘’)
{
if (class_exists(‘Imagick’)) {
$image = new Imagick();
try {
$filetoconvert = $fileinput.(($page != ‘’) ? ‘[’.$page.‘]’ : ‘’);
//var_dump($filetoconvert);
dol_syslog("Reading in " . $filetoconvert, LOG_WARNING);
$ret = $image->readImage($filetoconvert);
dol_syslog("Read in " . $filetoconvert . " ret = " . $ret, LOG_WARNING);
} catch (Exception $e) {
$ext = pathinfo($fileinput, PATHINFO_EXTENSION);
dol_syslog("Failed to read image using Imagick (Try to install package ‘apt-get install php-imagick ghostscript’ and check there is no policy to disable “.$ext.” conversion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
return 0;
}
And in my log I just got:
025-12-30 20:24:55 WARNING 76.23.223.48 123920 3365 Reading in /home4/loogrrte/dolibarrdata/commande/SO2512-0743/SO2512-0743.pdf[0]
So it seems to be failing in the ‘$image→readImage’ call, but without returning or generating an exception… That’d imply to me a crash, unless there is some other mechanism.
I wrote a small PHP script to call imagemagik in a similar way as dolibar and it segfaults, so there is the smoking gun.
The shared hosting doesn’t had gdb handy, but I ran it in strace and checked out the relevant libraries being loaded, and some did get updated right about the time we started having problems:
lrwxrwxrwx 1 root root 28 Dec 10 01:30 /lib64/libMagickCore-6.Q16.so → libMagickCore-6.Q16.so.6.0.0*
lrwxrwxrwx 1 root root 28 Dec 10 01:30 /lib64/libMagickCore-6.Q16.so.6 → libMagickCore-6.Q16.so.6.0.0*
-rwxr-xr-x 1 root root 2839072 Nov 25 03:32 /lib64/libMagickCore-6.Q16.so.6.0.0*
lrwxrwxrwx 1 root root 28 Dec 10 01:30 /lib64/libMagickWand-6.Q16.so → libMagickWand-6.Q16.so.6.0.0*
lrwxrwxrwx 1 root root 28 Dec 10 01:30 /lib64/libMagickWand-6.Q16.so.6 → libMagickWand-6.Q16.so.6.0.0*
-rwxr-xr-x 1 root root 1253736 Nov 25 03:32 /lib64/libMagickWand-6.Q16.so.6.0.0*
Sadly HostGator’s support system is such that, now that my ticket has been “escalated”, I have no way to communicating to support until they get back to me.
Honestly I don’t care about the PDF preview so I might just as well turn it off. I was hoping to make Dolibarr a little more resilient, or at least clear about this error, but given that it is a hard crash there is not a lot you can do about it without jumping through some major hoops.
Thank you everyone for contributing to this thread. Many of you are much more talented than I am with the backend systems.
On behalf of @carguin and @Locodarwin , I want to especially thank @jonbendtsen for keeping us on track to find the solution or workaround. I also want to thank @saikatkoley and @Jayden-Lee for helping with the beginning of the process and boosting the thread with their replies.
@carguin Please keep us informed of anything from Hostgator that will more fully resolve the problem.
Absolutely agree. Thanks to everyone who contributed. This workaround really saved my bacon, so to speak. I hope it proves helpful to others, too.
@carguin which file did you add that in, and is there a Class Imagick in some file in the Dolibarr repo or is it from a PHP Library?
TLDR: It is server resource quotas.
I got the feedback from Hostgator support. I’ll quote it in full. The “test_imagick_raw.php” script they reference is one that I wrote that does the same thing Dolibarr is doing but callable from the command line:
We dug into this further on the server side and were able to reproduce the problem directly against your Dolibarr install using the test_imagick_raw.php script. When that runs, the server hands the request to PHP, but the PHP process for your account is getting cut off by CloudLinux’s resource limits for this shared server. In the logs this shows as the PHP backend having “nothing to read from backend (LVE ID 3365; user ID 3365),” which basically means the process was stopped before it could answer. That lines up with what you’ve already seen: the issue appears right when Dolibarr calls ImageMagick to turn a PDF into a PNG preview.
So this isn’t a basic config or security block—it’s the PDF→PNG conversion pushing your shared account over its allowed CPU/process limits and the system shutting that request down, which results in the 503.
I’m a little shocked that converting a single-page PDF to a thumbnail PNG is hitting a limit; that’s not asking a lot.
They recommend the same workaround
As a practical workaround on this environment, the cleanest thing you can do is turn off the PDF thumbnail feature inside Dolibarr so it stops calling ImageMagick for those little previews. Dolibarr has a setting for this under its Other Setup section, usually exposed as MAIN_DISABLE_PDF_THUMBS. Once that change is in place, those heavy preview calls stop and the 503 tied to that conversion should go away.
And of course the actual solution is to buy more
If you need those previews long term, that’s where a developer or a move to a VPS/dedicated setup comes in, since those give you more headroom and tunable limits than we can provide on shared. In the short term though, disabling the thumbnails in Dolibarr is the best way to keep things stable.
Still an open question is whether they turned down a setting their shared hosting, or maybe a newer Imagick magic library is doing something that just pushes us over the threshold
That’s about as far as that’ll go. An actual fix to make this work in this environment would probably be to make the preview images get generated by some background process, and have the front-end cleanly handle the “preview generation in progress, try again later” or something.
which file did you add that in,
That’s in core/lib/files.lib.php
and is there a Class Imagick in some file in the Dolibarr repo or is it from a PHP Library?
I believe that is a standard PHP module.
Disappointing response from Hostgator. The dedicated server or VPC upgrade is significantly more expensive. Not worth it for this particular issue, IMHO. I don’t think I’ve ever cared about those previews. Thanks for the follow-up!
Thanks for the follow up from Hostgator. Hopefully others will find this thread in the future and know how to avoid our 3 week of troubles. I hope everyone here has a great New Year’s holiday and an even better 2026.




