Bug #14830
closedTypo3 Imagemagick static detection not working
0%
Description
I was just figuring out why my ImageMagick static binaries were not
detected by Typo3 in safe_mode php enviroment and came to supprising
results!
First of all I did chech that
exec('/usr/bin/convert');
actuall worked. And it DID! OK so I checked all other required files and
it also worked. But Typo3 still didn't found them. So i started to play
around with class.tx_install.php file and function checkImageMagick
which is responsible for detection.
Well somehow test failed here:
if (ini_get('open_basedir') ||
((at)file_exists($v)&&(at)is_file($v.$filename.$isExt)))
So I figured out that my "open_basedir" is empty so first one didn't
apply but also for example is_file($v.$filename.$isExt) returned false.
OK....So I did a little test:
echo exec('/usr/bin/whoami')."\n";
if (is_file('/usr/bin/whoami')){
echo "Exists: $v.$filename.$isExt\n";
}
DAMN I WAS SUPRISED!
whoami actually returned username so it executed, but is_file returned
FALSE! Beats me why!
Then I tried to play with:
is_dir('..') OK
is_dir('/') FALSE
is_file('/usr/bin/convert') FALSE
...
So when I commented out this "if" sentance that required either
open_basedir value or is_file Imagemagick started to WORK!
So there must be special cirmustance (everything is on linux server,
info follows) where Imagemagick detection FAILS even IM IS there!
- DEBUG SYSTEM INFORMATION - START ###
TYPO3_PORT :
PATH_INFO :
QUERY_STRING : TYPO3_INSTALL[type]=phpinfo
REQUEST_URI : /typo3/install/index.php?TYPO3_INSTALL[type]=phpinfo
HTTP_REFERER :
http://DELETED/typo3/install/index.php?TYPO3_INSTALL[type]=config
TYPO3_REQUEST_HOST : http://DELETED
TYPO3_REQUEST_URL :
http://DELETED/typo3/install/index.php?TYPO3_INSTALL[type]=phpinfo
TYPO3_REQUEST_SCRIPT: http://DELETED/typo3/install/index.php
TYPO3_REQUEST_DIR : http://DELETED/typo3/install/
TYPO3_SITE_URL : http://DELETED
TYPO3_SITE_SCRIPT : typo3/install/index.php?TYPO3_INSTALL[type]=phpinfo
TYPO3_SSL :
SCRIPT_NAME : /typo3/install/index.php
TYPO3_DOCUMENT_ROOT : /opt/sites/DELETED
SCRIPT_FILENAME : /opt/sites/DELETED/typo3/install/index.php
REMOTE_ADDR : 213.DELETED
REMOTE_HOST :
HTTP_USER_AGENT : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7.8) Gecko/20050511 Firefox/1.0.4
HTTP_ACCEPT_LANGUAGE:
CONST: PHP_OS : Linux
CONST: TYPO3_OS :
CONST: PATH_thisScri: /opt/sites/DELETED/typo3/install/index.php
CONST: php_sapi_name: apache2filter
OTHER: TYPO3_VERSION: 3.8.0
OTHER: PHP_VERSION : 4.3.10
imagecreatefromgif(): 1
imagecreatefrompng(): 1
imagecreatefromjpeg(: 1
imagegif() : 1
imagepng() : 1
imagejpeg() : 1
imagettftext() : 1
OTHER: IMAGE_TYPES : 15
OTHER: memory_limit : 32M
SERVER: SERVER_PORT : 80
SERVER: SERVER_SOFTW: Apache
SERVER: GATEWAY_INTE: CGI/1.1
SERVER: SCRIPT_NAME : /typo3/install/index.php
SERVER: PATH_TRANSLA: /opt/sites/DELETED/typo3/install/index.php
T3CV_GFX: image_proc: 1
T3CV_GFX: gdlib : 1
T3CV_GFX: gdlib_png : 0
T3CV_GFX: gdlib_2 : 0
T3CV_GFX: im : 1
T3CV_GFX: im_path : /usr/bin/
T3CV_GFX: im_path_lz: /usr/local/php/bin/
T3CV_GFX: im_version: 0
T3CV_GFX: im_negate_: 0
T3CV_GFX: im_imvMask: 0
T3CV_GFX: im_combine: combine - DEBUG SYSTEM INFORMATION - END ###
(issue imported from #M1212)
Updated by Chris topher over 14 years ago
To make a looong report short:
On Linux with safe_mode = On
in sysext/install/mod/class.tx_install.php -> checkImageMagick()
the following line returns the wrong value:
file_exists($v) && @is_file($v.$filename.$isExt)