I just set up mediawiki on http://www.staerk.de/thorsten. Whenever I upload an image I see the error message:
Error creating thumbnail: Unable to save thumbnail to destination
1. Permissions
Now the first thing you should check when you get this error message is that your server's directories are writeable to the web server process. This is Ubuntu Linux so as long as the files are owned by www-data everything is okay. They were so this is not the problem:
/var/www/staerk.de/thorsten# ll
-rw-r--r-- 1 www-data www-data 1088 Sep 3 18:56 thumb_handler.php
-rw-r--r-- 1 www-data www-data 956 Sep 3 18:56 thumb_handler.php5
-rw-r--r-- 1 www-data www-data 86 Sep 3 18:56 wiki.phtml
[...]
2. Logs
So I had to dig deeper. I looked into the server log if there was any entry at the time when I uploaded:
cat /var/log/apache/error_log
There was no message at these times so I moved on.
3. PHP's safe_mode
php's safe_mode feature is another thing that can make accessing files impossible. safe_mode is a great feature of PHP and it should never be turned off except for experimenting and troubleshooting. So I opened /etc/php5/apache2/php.ini, searched for safe_mode and set it to off:
safe_mode = Off
restarted the web server with the command
/etc/init.d/apache2 restart
and during the next time when I uploaded an image the error was gone.
So I set safe_mode to On again, restarted apache and entered the following line into /var/www/staerk.de/thorsten/LocalSettings.php:
putenv('TMPDIR=/var/www/staerk.de/thorsten');
Now whenever I upload a file I get a warning in /var/log/apache2/error.log like:
[Fri Oct 04 08:37:50 2013] [error] [client 95.113.203.63] PHP Warning: putenv(): Safe Mode warning: Cannot set environment variable 'TMPDIR' - it's not in the allowed list in /var/www/staerk.de/thorsten/LocalSettings.php on line 31, referer: http://www.staerk.de/thorsten/index.php/Special:Upload
So I set safe_mode to On again, restarted apache and entered the following line into /var/www/staerk.de/thorsten/LocalSettings.php:
putenv('TMPDIR=/var/www/staerk.de/thorsten');
Now whenever I upload a file I get a warning in /var/log/apache2/error.log like:
[Fri Oct 04 08:37:50 2013] [error] [client 95.113.203.63] PHP Warning: putenv(): Safe Mode warning: Cannot set environment variable 'TMPDIR' - it's not in the allowed list in /var/www/staerk.de/thorsten/LocalSettings.php on line 31, referer: http://www.staerk.de/thorsten/index.php/Special:Upload
So what is in the allowed list?
Looking into /etc/php5/apache2/php.ini helps. I set it to empty which allows to change all environment variables:
safe_mode_allowed_env_vars =
And the error changes. The error now says:
Error creating thumbnail: Unable to run external programs in safe mode.
Googling helped. In /var/www/staerk.de/thorsten/LocalSettings.php I added at the end:
$wgUseImageMagick = false
and it works as you can see on http://www.staerk.de/thorsten
Looking into /etc/php5/apache2/php.ini helps. I set it to empty which allows to change all environment variables:
safe_mode_allowed_env_vars =
And the error changes. The error now says:
Error creating thumbnail: Unable to run external programs in safe mode.
Googling helped. In /var/www/staerk.de/thorsten/LocalSettings.php I added at the end:
$wgUseImageMagick = false
and it works as you can see on http://www.staerk.de/thorsten
Keine Kommentare:
Kommentar veröffentlichen