Search code examples
drupalimagemagickopen-basedir

Drupal / ImageMagick Error: open_basedir restriction in effect


I'm trying to use the ImageMagick toolkit in Drupal, but keep getting this error:

warning: file_exists(): open_basedir restriction in effect. 
File(/usr/bin/convert) is not within the allowed path(s): 
(/var/www/vhosts/dev.mysite.com/dev2.mysite.com/drupal/:/tmp/) in 
/var/www/vhosts/dev.mysite.com/dev2.mysite.com/drupal-6.22/includes/image.imagemagick.inc 
on line 55.
No file /usr/bin/convert could be found. PHP's open_basedir security restriction 
is set to /var/www/vhosts/dev.mysite.com/dev2.mysite.com/drupal/:/tmp/, which 
may be interfering with the attempts to locate ImageMagick.

I've read many posts on Drupal forums and "around", and have tried various suggested solutions (setting my directory in Drupal to /sites/default/files/tmp, etc.), but so far, nothing has worked. At this point, since I do have access to php.ini, I was thinking I could edit it, but am wondering if editing it is the right way to go? I'm concerned whether adding /usr/bin/convert to the allowed paths in php.ini is a security issue or if there's another way to get it to work?


Solution

  • Created vhost.conf inside /var/www/vhosts/domain.tld/conf and restarted apache

    <Directory /var/www/vhosts/domain.tld/httpdocs>
    php_admin_value open_basedir none
    </Directory>
    

    How can I relax PHP's open_basedir restriction?

    Also, ran as root:

    yum install ImageMagick
    yum install ImageMagick-devel
    yum install php-pear
    pecl install imagick
    

    http://24x7servermanagement.com/blog/?p=754

    However, the last step I ran into issues with. It was solved when I called the server company, and I think they ran

    yum install kernel-devel kernel-headers