ImageMagick - setting Directory path not working

Graeck

Joined: 2009-07-28
Posts: 22
Posted: Wed, 2009-07-29 18:44


Gallery version: 2.3
PHP version: 5.2.6
PHPInfo Link: http://www.brewsession.com/info.php
Webserver: Apache 2.2.10 (Unix)
Database: MySQL 4.1.22-standard
Activated toolkits: GD
Operating system: Mac
Browser (e.g. Firefox 2.0): FF 3.5.1 & Safari 4.0.2

Hi all,
I've got gallery all set up and working, however I noticed my photo uploads were of pretty bad quality. Some research pointed to Gd bing not a very good graphics toolkit. So, my hosting service (Hostm.com) does support ImageMagick. When I asked where the binaries were located, they told me, "/usr/bin/".

So, I go to the plugins page in Gallery Admin and click to configure ImageMagick (1.1.5). I type in '/usr/bin/' as the path to the binaries and click save, but all I get is an error: "The path you entered doesn't contain valid ImageMagick binaries. Use the 'test' button to check where the error is."

So I click Test and get...

Binary Name Pass/Fail
identify
Failed
Error messages:

Problem executing binary:

identify
Failed
Error messages:

Problem executing binary:

convert
Failed
Error messages:

Problem executing binary:

composite
Failed
Error messages:

Problem executing binary

================================
is_dir(/usr/bin/)
Loading plugin imagemagick
imagemagick plugin successfully instantiated
Check the version of the imagemagick plugin
The version of the imagemagick plugin is ok
getcwd()
chdir(/home/brewsess/gallery_data/tmp/)
is_dir(/usr/bin/)
file_exists(/usr/bin/gm)
file_exists(/usr/bin/identify)
getParameter exec.beNice for core plugin
Executing: ( "/usr/bin/identify"
"/home/brewsess/public_html/gregandmiri.com/gallery2/modules/imagemagick/data/test.gif"
) 2>"/home/brewsess/gallery_data/tmp/g2dbgH8h4Yy"
getParameter exec.expectedStatus for core plugin
file_exists(/home/brewsess/gallery_data/tmp/g2dbgH8h4Yy)
filesize(/home/brewsess/gallery_data/tmp/g2dbgH8h4Yy)
unlink(/home/brewsess/gallery_data/tmp/g2dbgH8h4Yy)
Regular Output:
Error Output:
Status: (expected 0)
is_dir(/usr/bin/)
file_exists(/usr/bin/gm)
tempnam(/home/brewsess/gallery_data/tmp/, imgk_)
file_exists(/usr/bin/convert)
Executing: ( "/usr/bin/convert" "-size" "200x200" "-geometry" "200x200"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.gif"
"gif:/home/brewsess/gallery_data/tmp/imgk_rMUA1Q" )
2>"/home/brewsess/gallery_data/tmp/g2dbgLAP938"
file_exists(/home/brewsess/gallery_data/tmp/g2dbgLAP938)
filesize(/home/brewsess/gallery_data/tmp/g2dbgLAP938)
unlink(/home/brewsess/gallery_data/tmp/g2dbgLAP938)
Regular Output:
Error Output:
Status: (expected 0)
unlink(/home/brewsess/gallery_data/tmp/imgk_rMUA1Q)
is_dir(/usr/bin/)
file_exists(/usr/bin/gm)
file_exists(/usr/bin/combine)
file_exists(/usr/bin/composite)
is_executable(/usr/bin/composite)
is_dir(/usr/bin/)
file_exists(/usr/bin/gm)
tempnam(/home/brewsess/gallery_data/tmp/, imgk_)
Executing: ( "/usr/bin/composite" "-geometry" "+0+0"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.jpg"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.gif"
"gif:/home/brewsess/gallery_data/tmp/imgk_tbtR6q" )
2>"/home/brewsess/gallery_data/tmp/g2dbgT4BA9I"
file_exists(/home/brewsess/gallery_data/tmp/g2dbgT4BA9I)
filesize(/home/brewsess/gallery_data/tmp/g2dbgT4BA9I)
unlink(/home/brewsess/gallery_data/tmp/g2dbgT4BA9I)
Regular Output:
Error Output:
Status: (expected 0)
unlink(/home/brewsess/gallery_data/tmp/imgk_tbtR6q)
chdir(/home/brewsess/public_html/mywebsite.com)
========================

If I look in /usr/bin/ i only see a folder for X11. Looking around I found that in /usr/lib/ there are folders called "ImageMagick-6.0.7" and "ImageMagick-6.2.6". Looked promising, but I tried those and get similarly bad results.

I contacted Hostm.com and showed them the above. They say it shows that the binaries are there, so it's not a problem on their end.

Any help would be greatly appreciated!

Thanks

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2009-07-29 18:50

Actually, the problem is on their end. They are disabling the exec function so PHP cannot execute binary files.

Get that restriction removed and you can use ImageMagick or NetPBM.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Wed, 2009-07-29 19:07

Thanks, I'll see how that goes. ;-)

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Wed, 2009-07-29 19:50

So, I got a reply...

Quote:
To enable the exec PHP command, create a text file named 'php.ini' (all lowercase), and inside the text file should be this single line:

disable_functions = system,shell_exec,passthru

Then upload the 'php.ini' file into the folder(s) containing the scripts that require the command to be enabled. Do not upload this file into any other folder.

My question is, do you know where the folder containing these scripts is?

Thanks!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2009-07-29 19:55

My advice, upload it into the root of your Gallery. If that works, don't look back :)

If not, then I'll dig and figure out where it would need to be.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Wed, 2009-07-29 20:36

Yeah, it's working with php.ini in the gallery root. Am I opening up potential security issues though?

Also, even though hostm.com advertises "ImageMagick 6.2.0 or newer", Gallery picked up version 6.0.7 and gave me this warning:

Quote:
Version ImageMagick 6.0.7 -
Warning: This version of ImageMagick has known vulnerabilities that could be exploited to execute arbitrary commands or cause a denial of service (references: 1, 2, 3, 4). You may wish to upgrade. This determination may be inaccurate for ImageMagick packages in Linux distributions.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2009-07-29 20:43
Quote:
Am I opening up potential security issues though?

So long as you're running G2.3 and that change is only in your Gallery directory and you don't have other software installed there like WordPress, then I can't think of any.

As for ImageMagick, as your host if they'll upgrade. :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Wed, 2009-07-29 21:01

Ah, I found another directory (/usr/local/bin/) that has ImageMagick 6.5.4-6. Much better. Strange tech support they have.

Well, I have Wordpress installed, but not in the gallery2 directory of course. So I guess I should be ok.

Thanks for the help!

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Fri, 2009-07-31 00:34

Well, the strangest thing happened. It worked yesterday, but today it's giving me the same error again when using /usr/local/bin/. My php.ini file is still there, in the same place.....

 
Dayo

Joined: 2005-11-04
Posts: 1295
Posted: Sat, 2009-08-01 10:11

Perhaps since yesterday, your host has decided to stop allowing php.ini overrides or perhaps they decided to reinstall / upgrade IM which these days installs to /usr/bin and get rid of the version you are pointing to.

IM has been made a PITA to use since G2.3 but you need to get back to your host to see if they can help you.

--
dakanji.com

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Mon, 2009-08-10 01:16

I've tried using /usr/local/bin/ and /usr/bin/. Both have an install of ImageMagic, though it looks like the one in /usr/local/bin/ is newer. However, both of them are giving me the same errors again....

Quote:
is_dir(/usr/local/bin/)
Loading plugin imagemagick
imagemagick plugin successfully instantiated
Check the version of the imagemagick plugin
The version of the imagemagick plugin is ok
getcwd()
chdir(/home/brewsess/gallery_data/tmp/)
is_dir(/usr/local/bin/)
file_exists(/usr/local/bin/gm)
file_exists(/usr/local/bin/identify)
getParameter exec.beNice for core plugin
Executing: ( "/usr/local/bin/identify"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.gif"
) 2>"/home/brewsess/gallery_data/tmp/g2dbg4mqo8V"
getParameter exec.expectedStatus for core plugin
file_exists(/home/brewsess/gallery_data/tmp/g2dbg4mqo8V)
filesize(/home/brewsess/gallery_data/tmp/g2dbg4mqo8V)
unlink(/home/brewsess/gallery_data/tmp/g2dbg4mqo8V)
Regular Output:
Error Output:
Status: (expected 0)
is_dir(/usr/local/bin/)
file_exists(/usr/local/bin/gm)
tempnam(/home/brewsess/gallery_data/tmp/, imgk_)
file_exists(/usr/local/bin/convert)
Executing: ( "/usr/local/bin/convert" "-size" "200x200" "-geometry"
"200x200"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.gif"
"gif:/home/brewsess/gallery_data/tmp/imgk_rDTK1i" )
2>"/home/brewsess/gallery_data/tmp/g2dbguBF9UF"
file_exists(/home/brewsess/gallery_data/tmp/g2dbguBF9UF)
filesize(/home/brewsess/gallery_data/tmp/g2dbguBF9UF)
unlink(/home/brewsess/gallery_data/tmp/g2dbguBF9UF)
Regular Output:
Error Output:
Status: (expected 0)
unlink(/home/brewsess/gallery_data/tmp/imgk_rDTK1i)
is_dir(/usr/local/bin/)
file_exists(/usr/local/bin/gm)
file_exists(/usr/local/bin/combine)
file_exists(/usr/local/bin/composite)
is_executable(/usr/local/bin/composite)
is_dir(/usr/local/bin/)
file_exists(/usr/local/bin/gm)
tempnam(/home/brewsess/gallery_data/tmp/, imgk_)
Executing: ( "/usr/local/bin/composite" "-geometry" "+0+0"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.jpg"
"/home/brewsess/public_html/mywebsite.com/gallery2/modules/imagemagick/data/test.gif"
"gif:/home/brewsess/gallery_data/tmp/imgk_3l5GO2" )
2>"/home/brewsess/gallery_data/tmp/g2dbggTagIp"
file_exists(/home/brewsess/gallery_data/tmp/g2dbggTagIp)
filesize(/home/brewsess/gallery_data/tmp/g2dbggTagIp)
unlink(/home/brewsess/gallery_data/tmp/g2dbggTagIp)
Regular Output:
Error Output:
Status: (expected 0)
unlink(/home/brewsess/gallery_data/tmp/imgk_3l5GO2)
chdir(/home/brewsess/public_html/mywebsite.com)

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Mon, 2009-08-10 01:39

THey just sent me this:
We installed a test copy of Gallery2 using the built-in Fantastico installer, and inserted the same php.ini file and the ImageMagick test seems to work fine.

You may wish to look for the differences between the 2 copies of Gallery2. Please note that we do not perform troubleshooting of manually installed scripts.

When I looked at their test intsall, I did notice that ImageMagick has been upgraded since I installed this a couple weeks ago. It's in the same directory though. I tried disabling, uninstalling, and reinstalling the ImageMagick plugin within gallery, but that didn't change anything.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-08-10 03:25

Post a link to a phpinfo file that's in the same directory as your Gallery install.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Graeck

Joined: 2009-07-28
Posts: 22
Posted: Mon, 2009-08-10 04:21

I gave up. I reinstalled Gallery2 into a new directory, re-uploaded the (same) php.ini file and now it works again. Really strange!

(of course I have a new issue now, but that's for a different thread)

Thanks for the all the help!