Gallery Project can't find ImageMagick binaries

I'm migrating my install of Gallery(http://galleryproject.org/) over to a new server(CentOS 6.6).  I'm having issues with getting ImageMagick to activate. i'm running PHP 5.3.29.

At the moment its a clean install with Direct Admin.

I found some code online to test imagemagick, http://www.constantly.org/testing/testing.php and it looks like its running correctly on my test link.

When i go to configure Imagemagick in gallery, Here is what the screen mentions:
------------------------------
ImageMagick is a graphics toolkit that can be used to process images that you upload to Gallery. You must install the ImageMagick binaries on your server, then enter the path to them in the text box below. If you're on a Unix machine, don't forget to make the binaries executable (chmod 755 * in the ImageMagick directory should do it)

Directory to ImageMagick/GraphicsMagick binaries:      /usr/local/bin/
-------------------------------

When i put in my path /usr/local/bin, i get an error saying , "The path you entered is not a valid directory or is not accessible."


As far is i know the permissions are good, since it works from my testing.php above. Does anyone have any other ideas i can try to solve this? I've never had this error on any other servers.


Thanks!!
AfternoonShiftAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NerdsOfTechTechnology ScientistCommented:
Upload your test script here
0
AfternoonShiftAuthor Commented:
<?php

echo "Using convert:<br>";
$array = array();
echo "<pre>";
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("convert input.jpg -thumbnail 500x500 output1.jpg 2>&1", $array);
print_r( $array );
echo"</pre>";

echo "Using /usr/local/bin/convert:<br>";
$array = array();
echo "<pre>";
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("/usr/local/bin/convert input.jpg -thumbnail 500x500 output2.jpg 2>&1", $array);
print_r( $array );
echo"</pre>";

?>
<img src="output1.jpg"><br>
<img src="output2.jpg">

<br />
<br />


<?php
system("/usr/local/bin/convert -version");
?>
<br />

<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>
<br />

<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
0
AfternoonShiftAuthor Commented:
since i'm not sure exactly what' wrong... could this be the issue?

[root@server admin]# rpm -Uvh ImageMagick-6.9.1-1.x86_64.rpm
error: Failed dependencies:
        ImageMagick-libs = 6.9.1-1 is needed by ImageMagick-6.9.1-1.x86_64
        libMagickCore-6.Q16.so.2()(64bit) is needed by ImageMagick-6.9.1-1.x86_64
        libMagickWand-6.Q16.so.2()(64bit) is needed by ImageMagick-6.9.1-1.x86_64
        libfftw3.so.3()(64bit) is needed by ImageMagick-6.9.1-1.x86_64
        libltdl.so.3()(64bit) is needed by ImageMagick-6.9.1-1.x86_64
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

AfternoonShiftAuthor Commented:
whats the permissions for the /bin folder and /usr/bin/?

it's currently:
dr-xr-xr-x.   2 root root  4096 Apr 12 03:11 bin

while my older server was this:
drwxr-xr-x   2 root root 4096 Nov  4 04:19 bin
0
NerdsOfTechTechnology ScientistCommented:
You are correct in chmod / changing the directory permissions to 755 rwxr-xr-x from your current state of 644 r-xr-xr-x (which prohibited owner code from writing / creating images)

Some admins put stricter permissions on the directories such as 770, 760, etc., and keep owner writing on. Without assuming your environment, depending on your security needs, change the directory permissions to the appropriate security settings for your environment.

Permissions should solve the problem
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AfternoonShiftAuthor Commented:
while i can get it to execute from the script above, it seems like it still doesn't work from 2 different gallery web apps. I'm fresh out of ideas and at this point just going to scrap ImageMagick and go with Gd. hopefully i can figure out what is causing these issues down the road.  i even made the web app dir 777 for test purposes and change chown to apache, but no change.
0
NerdsOfTechTechnology ScientistCommented:
The files within the directories also need to be at 775 through 760 (depending on your environment). Temporarily chmod the upper and lower directories as well as the files required, and test.

The files themselves need to have write permissions for owner (first number must be 7).

There's still hope for this extremely powerful library.
0
NerdsOfTechTechnology ScientistCommented:
Furthermore gd would require the same set of permissions. Solving this issue is needed for any library that will "create" files.

P. S. Revert chown if needed in above test if needed
0
AfternoonShiftAuthor Commented:
That's what i don't understand.. GD works without issues.

http://www.constantly.org/magic.php
^^ shows that i have imagemagick installed.

Since gallery project was giving me issues, i tried coopermine image gallery
http://www.constantly.org/cpg15x/install.php?step=4
^^ if you go into that setup page, you will see that IM/GD are listed as install on the server. If GD is selected, step 5 works. If you go back and select IM, it fails.

"Read/write .gif file
Could not read the source image.      Generated image      Reference image"

drwxrwxrwx 14 apache     apache         4096 Oct 24 11:50 cpg15x ... i gave it 777 temporarily to eliminate any doubt that the gallery app didn't have permission.  So maybe there something in the system that isn't allowing it to process the files?
0
NerdsOfTechTechnology ScientistCommented:
.htaccess maybe?
Does the image source file and directory have 644 (should be 775)?
Try reinstalling im
0
AfternoonShiftAuthor Commented:
the albums folders need to be 775. which they are. If i don't have it at 775, the installer doesn't work at all.

i'm not to familiar with .htaccess. My last server never had these issues, but this new server has DirectAdmin installed, which i think is what is causing this weird issues with IM.

[root@server cpg15x]# /usr/local/bin/identify -list configure

Path: /usr/local/lib/ImageMagick-6.9.1//config-Q16/configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             gcc -std=gnu99 -std=gnu99
CFLAGS         -I/usr/include/freetype2 -fopenmp -g -O2 -Wall -march=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /usr/local/lib/ImageMagick-6.9.1/modules-Q16/coders
CONFIGURE      ./configure  '--with-perl=/usr/bin/perl'
CONFIGURE_PATH /usr/local/etc/ImageMagick-6/
COPYRIGHT      Copyright (C) 1999-2015 ImageMagick Studio LLC
CPPFLAGS       -I/usr/local/include/ImageMagick-6
CXX            g++
CXXFLAGS       -g -O2 -pthread
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg freetype jng jpeg lcms png ps tiff x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-gvc=no --with-rsvg=no --with-wmf=no --with-perl=/usr/bin/perl
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6
EXEC-PREFIX    /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES       DPC OpenMP
FILTER_PATH    /usr/local/lib/ImageMagick-6.9.1/modules-Q16/filters
HOST           x86_64-unknown-linux-gnu
INCLUDE_PATH   /usr/local/include/ImageMagick-6
LDFLAGS        -L/usr/local/lib -L/usr/local/lib
LIB_VERSION    0x691
LIB_VERSION_NUMBER 6,9,1,1
LIBRARY_PATH   /usr/local/lib/ImageMagick-6.9.1
LIBS           -llcms -ltiff -lfreetype -ljpeg -lpng12 -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lm -lgomp
NAME           ImageMagick
PCFLAGS        -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /usr/local
QuantumDepth   16
RELEASE_DATE   2015-04-17
SHARE_PATH     /usr/local/share/ImageMagick-6
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.9.1/config-Q16
SVN_REVISION   18308
TARGET_CPU     x86_64
TARGET_OS      linux-gnu
TARGET_VENDOR  unknown
VERSION        6.9.1
WEBSITE        http://www.imagemagick.org

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
FEATURES       OpenMP
NAME           ImageMagick
QuantumDepth   16
0
NerdsOfTechTechnology ScientistCommented:
if you have .htaccess (apache directives) on any directory that is restricting access to the files, this could cause issues like this as well. Recommendation: uninstall / reinstall im and check for .htaccess files on root directory and subfolders. If any .htaccess exist, open them and see if chmod and/or access permissions exists in them. if so upload them here if you need assistance with them.
0
AfternoonShiftAuthor Commented:
there is a .htaccess file that is created during install.

DirectoryIndex .htaccess
SetHandler Gallery_Security_Do_Not_Remove
Options None
<IfModule mod_rewrite.c>
RewriteEngine off
</IfModule>
Order allow,deny
Deny from all

While setting up the 2nd domain on the server i did run into a way to get it to work...but still doesn't explain why. Maybe you know..

so i went through setup again on "Project Gallery", but instead of using the domain, i used the ip address.  If i use the ip address, imagemagic passses.

For testing purposes, once i change the config back to the domain and hit "test for imagemagick", it fails: "The path you entered is not a valid directory or is not accessible."

Same error happens with Coopermine Gallery.  See below.

http://173.208.245.178/~constantly/cpg15x/install.php?step=4   --- Imagemagick passes
http://constantly.org/cpg15x/install.php?step=4  --- Imagemagick fails
0
AfternoonShiftAuthor Commented:
Thanks for taking the time to help me with this! as of now its solved! i just configure the imagemagick via the IP.  Very strange issue, but works! :D
0
AfternoonShiftAuthor Commented:
while i still don't understand while i need to use the IP, it works and allows me to use imagemagick for my gallery apps.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.