ImageMagick Plesk and open_basedir

PHPBecause of the way that ‘open_basedir’ works in restricting everything some things that you access file system wise in code, it will restrict you also in using programs such as ImageMagick , or in applications that may use it such as Coppermine Gallery or Menalto Gallery.

To fix this you need to either turn off openbase_dir or make it so that the PHP running on the target domain can access the directory where ImageMagick resides. First you need to modify your vhost.conf, you can see examples of modifying/changing/reloading this config file here.

php_admin_value open_basedir /var/www/vhosts/

Above you can see the line of code that needs to be added, the first two options ‘/var/www/vhosts/’ and ‘/tmp’ are the default running settings (restricting things), so when defining the value of the open_basedir you need to re-declare these two. The third path allows our PHP to access that folder when running, and so can now access ImageMagick etc, along with a lot of other things.. Security risk perhaps, but at least it works for now.

I’ll look into a more secure method, please comment if you can suggest/add anything to this topic.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.