Topic on Project:Support desk

Summary by Ciencia Al Poder

Old thread, please create new one

TraaBBIT (talkcontribs)
Malyacko (talkcontribs)
TraaBBIT (talkcontribs)

O

I will look on that.

What option is the best for creating thumbnalis?

SVG

ImageMagick

Batik

rsvg

JPEG

JPEG (using GD)

Ciencia Al Poder (talkcontribs)

ImageMagick is used by default and is good

TraaBBIT (talkcontribs)

I have put that code in my LocalSettings.php

#ImageMagic

$wgUseImageMagick = true;

$wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; # for windows

$wgImageMagickConvertCommand = '/usr/local/bin/convert';

TraaBBIT (talkcontribs)

Could somebody help me with that?

2003:72:6D19:D800:1CF1:628E:6F5C:D1F0 (talkcontribs)

Error code 127 is happening in a number of cases. It might help to look into the web server error log. Maybe it contains more information on what is going wrong.

Your line with C:\ImageMagick is superfluous and can be commented out or even removed.

On the shell, please try this command:

/usr/local/bin/convert --version

What does it return?

2003:72:6D19:D800:1CF1:628E:6F5C:D1F0 (talkcontribs)

Another approach would be to enable debbuging in MediaWiki. This can be done as described at Manual:How_to_debug#Logging. Then call a page, on which MediaWiki would show a thumbnail, which does not yet exist. In this case the debug log will contain information on what MediaWiki is doing to create the thumbnail and how it is failing during thumbnail creation.

TraaBBIT (talkcontribs)

I run

/usr/local/bin/convert --version

and got:

Version: ImageMagick 6.9.3-2 Q16 x86_64 2016-02-04 http://www.imagemagick.org

Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC

License: http://www.imagemagick.org/script/license.php

Features: Cipher DPC OpenMP

Delegates (built-in): bzlib fontconfig freetype jbig jng jpeg lzma png tiff webp x xml zlib

TraaBBIT (talkcontribs)

I also put to my LocalSettings.php that code:

/**

 * The debug log file must never be publicly accessible because it

 * contains private data. But ensure that the directory is writeable by the

 * PHP script running within your Web server.

 * The filename is with the database name of the wiki.

 */

$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";

wfErrorLog( "An error occurred.\n", '/var/log/mediawiki/my-custom-debug.log' );

/**

 * The debug log file should be not be publicly accessible if it is used, as it

 * may contain private data. However, it must be in a directory to which PHP run

 * within your web server can write.

 *

 * Contrary to wgDebugLogFile, it is not necessary to include a wiki-id in these log file names

 * if you have multiple wikis. These log entries are prefixed with sufficient information to

 * identify the relevant wiki (web server hostname and wiki-id).

 */

// Groups from MediaWiki core

$wgDBerrorLog = '/var/log/mediawiki/dberror.log';

$wgRateLimitLog = '/var/log/mediawiki/ratelimit.log';

$wgDebugLogGroups = array(

'resourceloader' => '/var/log/mediawiki/resourceloader.log',

'exception' => '/var/log/mediawiki/exception.log',

'error' => '/var/log/mediawiki/error.log',

#'exception-json' => '/var/log/mediawiki/exception.json',

// Extra log groups from your extension

#'myextension' => '/var/log/mediawiki/myextension.log',

#'somegroup' => '/var/log/mediawiki/somegroup.log',

);

if ( $module->hasFailed ) {

    wfDebugLog( 'myextension', "Something is not right, module {$module->name} failed." );

}

But I don't get any log file.

Ciencia Al Poder (talkcontribs)

Be sure PHP can write to /var/log/mediawiki/. Adjust file owner or permissions

TraaBBIT (talkcontribs)

How to do that? :)

Ciencia Al Poder (talkcontribs)

search the freaking web? set permissions to 777, trying to explain how to get owner of the process executing php is out of the scope here...

TraaBBIT (talkcontribs)

here is no option on my hosting to use /var/log/mediawiki/

Ciencia Al Poder (talkcontribs)

Have you tried to use another path? Ideally one not accessible from the internet

2003:72:6D1D:7900:7412:1D13:3AFD:C8A7 (talkcontribs)

I would say the image processing settings look alright then.

I think you can also get a debug log by setting

$wgDebugToolbar = true;

in LocalSettings.php. Note that the debug log as displayd there contains sensitive information, which a normal visitor should not be getting! Also note that we need the log not from any request, but specially from a request, in which MediaWiki is trying to create a formerly missing thumbnail.

2003:72:6D1D:7900:7412:1D13:3AFD:C8A7 (talkcontribs)

Your MediaWiki version is 1.27.3.

TraaBBIT (talkcontribs)
2003:72:6D17:800:3199:28E7:59BD:1070 (talkcontribs)

Here is the relevant part from debug log:

File::transform: Doing stat for mwstore://local-backend/local-thumb/5/51/House_Stark.PNG/50px-House_Stark.PNG

FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/5/51/House_Stark.PNG/50px-House_Stark.PNG does not exist.

TransformationalImageHandler::doTransform: creating 50x55 thumbnail at /tmp/transform_7bcb7123e0f4.png using scaler im

TransformationalImageHandler::doTransform: called wfMkdirParents(/tmp)

BitmapHandler::transformImageMagick: running ImageMagick: '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'

wfShellExec: OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png' 2>&1

[exec] Possibly missing executable file: OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png' 2>&1

[thumbnail] thumbnail failed on westeros.com.pl: error 127 "" from "'/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'"

[thumbnail] Removing bad 0-byte thumbnail "/tmp/transform_7bcb7123e0f4.png". unlink() succeeded
TraaBBIT (talkcontribs)

OK.

So what should I do now?

2003:72:6D17:800:A413:6747:C981:9449 (talkcontribs)

I would now try running the command from the shell and see, what output it creates.

TraaBBIT (talkcontribs)

Which command?

Ciencia Al Poder (talkcontribs)

this command:

OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
TraaBBIT (talkcontribs)

Hello.

I ran this command and got:

[budrysl2@s53:: ~/domains/westeros.com.pl/public_html ]:$ OMP_NUM_THREADS='1' '/                    usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/dom                    ains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x5                    5!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG'                     '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png                    ';

[budrysl2@s53:: ~/domains/westeros.com.pl/public_html ]:$ OMP_NUM_THREADS='1' '/                    usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/dom                    ains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x5                    5!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG'                     '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png                    '

So nothing happened.

Ciencia Al Poder (talkcontribs)

If /tmp/transform_7bcb7123e0f4.png exists then the command succeeded.

Note, however, that you ran this command under a different user than the webserver. You should remove that temp file and try again, this time with the sudo command, specifying the user account under php runs on your webserver.

For example, if using php-fpm, it may be "sudo -u php-fpm (the entire command)"

2003:72:6D12:B600:E0CA:7710:7FB3:FE3D (talkcontribs)

> If /tmp/transform_7bcb7123e0f4.png exists...

...and if this file is 'not an empty file with a file size of zero bytes.

And it must have been created with the current execution of the command and not with an earlier one...

TraaBBIT (talkcontribs)

I tried to run with sudo:

[budrysl2@s53:: ~/domains/westeros.com.pl/public_html/images/temp ]:$ sudo OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'

[sudo] password for budrysl2:

Niestety, proszę spróbować ponownie.

[sudo] password for budrysl2:

Niestety użytkownik budrysl2 nie ma uprawnień do uruchamiania '/usr/local/bin/convert -quality 95 -background white /home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG -thumbnail 50x55! -set comment File source: http://westeros.com.pl/Plik:House_Stark.PNG +set Thumb::URI -depth 8 -rotate -0 /tmp/transform_7bcb7123e0f4.png' jako root na s53.linuxpl.com.

I don't have catalog temp.

Temp is only in catalog images. There are many catalogs from 1 to f.

TraaBBIT (talkcontribs)

I could give You access to my SSH if You want.

Ciencia Al Poder (talkcontribs)

if you don't have a /tmp folder it may be very well the issue here, because it needs to exist and be writeable by the webserver when executing the convert command.

Note that it should be /tmp seen from the filesystem, not /tmp from the webserver root (westeros.com.pl/tmp)!

If the system /tmp folder is somewhere else, you may want to set $wgTmpDirectory to that folder, and/or $wgImageMagickTempDir.

TraaBBIT (talkcontribs)

So I need some /temp on mediawiki system?

Ciencia Al Poder (talkcontribs)

Yes, MediaWiki needs a folder where it can write temporary files before publishing them on the final destination.

TraaBBIT (talkcontribs)
TraaBBIT (talkcontribs)

I check with my hosting and they tell me that I have /temp and I can use it/

AhmadF.Cheema (talkcontribs)

Yes.

TraaBBIT (talkcontribs)

And what about that second setting:

$wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; # for windows

How could I use that one?

AhmadF.Cheema (talkcontribs)

Are you using Windows for your MediaWiki installation? If you aren't, then the line is useless or might even be causing fatal errors.

TraaBBIT (talkcontribs)

What do You mean?

I have hosting based on Linux.

TraaBBIT (talkcontribs)

I checked /tmp and found transform_7bcb7123e0f4.png

Ciencia Al Poder (talkcontribs)

Good. Remove the /tmp/transform_7bcb7123e0f4.png file and run the command again, changing the "www-user" with the user running php (if apache-mod-php, the user running apache, if php-fpm the php-fpm user, etc)

sudo -u www-user OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
TraaBBIT (talkcontribs)

can't run:

sudo -u php-fpm OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'

or

sudo -u apache-mod-php OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'

I get error: Unknown user.

TraaBBIT (talkcontribs)

I can't use sudo on my hosting.

TraaBBIT (talkcontribs)

And I don't have apache-mod-php and php-fpm

TraaBBIT (talkcontribs)

I have no idea what could be wrong :)

This post was hidden by AhmadF.Cheema (history)