php.net |  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-11 16:19 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: a4992214 at gmail dot com Assigned:
Status: Feedback Package: imagick (PECL)
PHP Version: 7.3.28 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-05-06 13:24 UTC] a4992214 at gmail dot com
Description:
------------
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:
---------------
<?php
    
$fn = 'https://www.methodfish.com/images/crop2493_1.png';

$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 https://www.methodfish.com/images/crop2493_1.png 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 
/var/www/vhosts/..../test.php:6

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-06 14:36 UTC] cmb@php.net
-Package: *Graphics related +Package: imagick
 [2021-06-11 16:19 UTC] danack@php.net
-Status: Open +Status: Feedback
 [2021-06-11 16:19 UTC] danack@php.net
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.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 04:01:24 2021 UTC