PHP ImagickException: not authorized

LukePOLO picture LukePOLO · Jun 2, 2016 · Viewed 18.1k times · Source

Any ideas how to fix this ?

 ImagickException: not authorized `/tmp/magick-1552lvf2nIjaqx1W' @ error/constitute.c/ReadImage/412 

I thought it was a permission issue so just to test it out i set my /tmp dir to 777. No change. Its driving me crazy.

The command :

<?php


$image = new \Imagick();
$image->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $graph);

Answer

Rakesh Kasinathan picture Rakesh Kasinathan · Oct 6, 2018

I have followed the below Steps to fix the Fatal error:

Uncaught ImagickException: not authorized `../../c02_001.pdf'
@ error/constitute.c/ReadImage/412 

  1. sudo vi policy.xml from etc/Imagemagick-6/
  2. comment the following line

    <!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
    
  3. Rewrite the following line

    <policy domain="coder" rights="none" pattern="PDF" />
    

    to

    <policy domain="coder" rights="read|write" pattern="PDF" />
    
  4. sudo apt-get install inkscape

  5. Restart apache with following command sudo restart apache2