image resize thumbnails on synology diskstation

Fragment of a discussion from Project:Support desk
Jump to: navigation, search
Edited by 2 users.
Last edit: 18:53, 30 November 2013

thanks guys, i checked by turning on those options in LocalSettings.php

$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
$gwDevelopmentWarnings = true;
$wgShowSQLErrors = true;
$wgDebugDumpSql  = true;
$wgShowDBErrorBacktrace = true;

alright, so I loaded an article with a thumbnail on it and on the thumbnail it says:

ehler beim Erstellen des Vorschaubildes: 
Warning: passthru(): PHP exec disable. in /volume1/web/mediawiki/includes/GlobalFunctions.php on line 2854

which wonders me, so I checked if there is a) safe_mode=off and b) there is no disable_function set

I also tested these PHP scripts:

<?php
if(function_exists('exec')) {
    echo "exec is enabled";
}
?>

and

<?php
if( ini_get('safe_mode') ){ 
  echo "safe mode is on"; 
}else{ 
   echo "safe mode is off";
   }  
?>

I put them in the mediawiki main directory where the index.php is and ran them. They output "exec is enabled" and "safe mode is off".

So how could exec still be disabled?

I also set up a log file with $wgDebugFile and when i search convert it says this line:

BitmapHandler::transformImageMagick: running ImageMagick: '/usr/bin/convert' -quality 95 -background white  '/volume1/web/mediawiki/uploads/d/de/Firemans_carry.png'  -thumbnail '100x63!' -set comment 'File source: http://mydomain/mediawiki/index.php/Datei:Firemans_carry.png' -depth 8   -rotate -0   '/volume1/web/mediawiki/uploads/temp/transform_7b7f803965ea-1.png' 2>&1

when I copy the line and get it running on the shell beginnine with /usr/bin/convert, it works. in the temp directory there is a nice small .png file which I can open

when i search Next, I am getting this line

wfShellExec: /bin/bash '/volume1/web/mediawiki/includes/limit.sh' 'OMP_NUM_THREADS='\1'\ '\/usr/bin/convert'\ -quality 95 -background white  '\/volume1/web/mediawiki/uploads/d/de/Firemans_carry.png'\  -thumbnail '\100x63!'\ -set comment '\File source: mydomain/mediawiki/index.php/Datei:Firemans_carry.png'\ -depth 8   -rotate -0   '\/volume1/web/mediawiki/uploads/temp/transform_7b7f803965ea-1.png'\ 2>&1' 'MW_CPU_LIMIT=180; MW_CGROUP='\'\; MW_MEM_LIMIT=409600; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180'

ok, first thing I tried was to try this line on the shell as well and see - it says /bin/bash - file does not exist. Since Synology Diskstation is using Apache IPKG as Package Management because it needs special installation packages made for it's marvell ARM processor, it is installing new packages in /opt/bin. So I made a link from /opt/bin/bash to /bin/bash and now this line works as well. Seems that from now on this line is gone from my log file, but I still get not thumbnail:

I reloaded the page and now it takes longer to load and before it loads there is a millisecond-long flash like there would be a reallocation of HTML elements but it quits and throws the same error where the thumbnail should be.

I also checked the limits.sh and it says:

MW_CPU_LIMIT=0
MW_CGROUP=
MW_MEM_LIMIT=0
MW_FILE_SIZE_LIMIT=0
MW_WALL_CLOCK_LIMIT=0

So these might not be the error as well and the Limits are set via command line laters othey would be overwriten as well. But to be srue I increased $wgMaxShellMemory to 809600 just to be sure. then i tried again - still no thumbnail:

now, when i search the filename of the pic, firemans_carry.png, it says this line as well:

Title::getRestrictionTypes: applicable restrictions to [[Firemans Carry]] are {edit,move}

Well i think this is some Mediawiki internate with user management permissions for this image, so I don't think it has anything to do with the problem.

I also find:

File::transform: Doing stat for mwstore://local-backend/local-thumb/d/de/Firemans_carry.png/120px-Firemans_carry.png
FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/d/de/Firemans_carry.png/120px-Firemans_carry.png does not exist.
Dafrk (talk)17:15, 30 November 2013

Hi!

So the error you see now is

Warning: passthru(): PHP exec disable. in /volume1/web/mediawiki/includes/GlobalFunctions.php on line 2854

Honestly I do not understand, if that should tell you that passthru() is missing or if it is exec(). However, I would try with a file with this content

<?php phpinfo();?>

which, when called with the browser, will show you amongst other things, which functions really are disabled. Make sure to enable that/those function(s), which are missing (passthru, exec) and then try again...

88.130.68.6518:51, 30 November 2013

yeah, as I expected, phpinfo shows no value for disable_function. there is also no open_basedir set and safe mode is off, too.


What I have discovered is, that I do not have a imagick.so. Can this be the reason for my problem? I don't think that imagick.so is necessary because imagemagick is called via command line and not by the imagick-PHP-Extension.

I tried the following php script:

<?php
$exec = exec("convert /volume1/public/double_leg.jpg /volume1/public/double_leg.png", $output, $return);
echo $exec;
echo "<br />----------------<br />";
print_r($output);
echo "<br />----------------<br />";
print_r($return);
?>

If I run it in the browser from the mediawiki root directory, it doesn't work. If i run it by shell with "php file.php" it works. Seems something's really wrong with exec.


Edit: I am still open for any more suggestions on how to fix the problem, but google research brought me to think that Synology somehow turned off the php exec-function hard-coded. It seems dependant on what Diskstation you have if you can fix this or not. Users using my model (DS107+) are stating that they didn't suceed in getting exec to run. Until I find out anything else, I am using ImageResize without imageMagick for now.

Dafrk (talk)21:32, 30 November 2013

Hi,

I also use the Synology DiskStation to host my MediaWiki. I had also the problems with the image processing (described above). But I was able to fix these issues by updating the version of MediaWiki.

Original (installed) Version 1.19 beta2
Tested (working) Version 1.19.11

Short description:

  • ssh terminal as root
  • rename existing folder /var/services/web/MediaWiki
  • extract new version in /var/services/web
  • change owner und group to nobody
  • create a soft link /var/services/web/MediaWiki for the new folder
  • copy the old image folder and the LocalSettings.php in the new folder
  • change some entries in the LocalSettings.php
 $wgEnableUploads  = true;
 $wgUseImageMagick = true;
 $wgImageMagickConvertCommand = "/usr/syno/bin/convert";
I found on my System the program convert in the folder /usr/syno/bin. To check your system, use the following command:
 type convert
  • Call the update function
 php maintenance/update.php
94.223.174.6223:33, 4 February 2014