Fixing MediaWiki Image Loading After PHP Upgrade

After upgrading my server from PHP 5.6 to PHP 7.4, I encountered an issue with MediaWiki 1.29 where images stopped loading. Every image request resulted in an HTTP 500 error.

The Problem

Checking the Apache error logs at /var/log/apache2/error.log, I found this error:

/var/www/vhosts/example.com/images/.htaccess: Option FollowSymLinks not allowed here

The .htaccess file in the MediaWiki images directory was trying to use Options +FollowSymLinks, but the Apache configuration no longer permitted this option to be set via .htaccess files.

The Solution

I edited the .htaccess file in the images directory and replaced:

Options +FollowSymLinks

with:

Options +SymLinksIfOwnerMatch

This alternative option provides similar functionality while being compatible with stricter Apache security settings. After making this change, all images loaded correctly again.

Conclusion

When upgrading PHP versions, server configurations often change as well. Checking the error logs is essential for identifying compatibility issues that may arise with older applications like MediaWiki 1.29.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.