|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81016 imagick throwing out “Uncaught ImagickException: unable to open file”
Submitted: 2021-05-06 13:24 UTC Modified: 2021-06-20 04:22 UTC
Avg. Score:4.1 ± 1.0
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:4 (80.0%)
From: a4992214 at gmail dot com Assigned:
Status: No Feedback Package: imagick (PECL)
PHP Version: 7.3.28 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: a4992214 at gmail dot com
New email:
PHP Version: OS:


 [2021-05-06 13:24 UTC] a4992214 at gmail dot com
running the line

$fn = '/var/www/vhosts/.........../myfile.png';
$im = new imagick($fn); // where myfile.png exists and can be viewed if run directly from the browser

but I get the following error:

Uncaught ImagickException: unable to open file `/tmp/magick-5465d-r7LT2tZ8Ip': No such file or directory @ error/constitute.c/ReadImage/604 in ....

When I run the same code on a different server, it works!
When I run against another test file it works ok. 

If it is something about myfile.png that is causing this problem then improved error messages should be given

Test script:
$fn = '';

$im = new Imagick();
$im->readImage($fn);  // <------ it blows up here (line 6)

// Display the image
header("Content-Type: image/png");
echo $im->getImageBlob();

Expected result:
I would hope to see the image on the screen

Actual result:
Fatal error: Uncaught ImagickException: unable to open file `/var/www/vhosts/......./tmp/magick-19229B77I2QMCe1Z2': No such file or directory @ error/constitute.c/ReadImage/604 in 

Stack trace: 
#0 /var/www/vhosts/......./test.php(6): Imagick->readimage('https://www.met...') 
#1 {main} thrown in /var/www/vhosts/...../test.php on line 6


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-06 14:36 UTC]
-Package: *Graphics related +Package: imagick
 [2021-06-11 16:19 UTC]
-Status: Open +Status: Feedback
 [2021-06-11 16:19 UTC]
Unless you have any evidence otherwise, this is going to be a file permissions issue.

One of you servers is configured to upload files with a user-ownership that works, and another is slightly misconfigured to have not give Imagick access to the file.

But that's outside the scope of fixing in Imagick.
 [2021-06-20 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 11:01:32 2024 UTC