PHP 5 safe mode

There is a parameter to index.php called safemode - that is completely unrelated.

Safe mode criticism
PHP's safe_mode is an ill-conceived, broken-by-design setting in PHP that is supposed to make broken scripts safe. It was deprecated in PHP 5.3 and removed in PHP 5.4 (see the PHP documentation). MediaWiki can run with safe_mode enabled, but many of the advanced features will not work or need additional configuration.

To turn off safe mode, put this into your php.ini file:

If you cannot turn safe_mode off (such is the case with many shared webhosts), please consider finding a new host. If that is out of the question, read the next section for methods to enable some things with safe_mode on. It is recommended that if you do have access to php.ini, that you turn safe_mode off instead of using the methods described below.

Another opinion
Safe mode is really a bad solution. Default MediaWiki installs are generally safe and do not require safe_mode to be enabled, but if you are really paranoid, you still can set up full-featured wiki with some effort. However, you should not do this.

Image upload and deletion workaround
To make image uploads and deletions work in your wiki, you need to create the images/archive, images/temp, images/deleted, and images/thumb directories and make them all writable by your webserver (chmod 777). Then, set the following in your LocalSettings.php file:

Fixing errors with putenv function
Sometimes you will see errors that putenv can't work properly because of safe mode. It doesn't affect any functionality but looks rather bad for user. To remove errors, you can either comment lines in wiki source code (not recommended), or disable error reporting in PHP by setting the following at the top of your LocalSettings.php file

Setting time zone in safe mode
In safe mode, things like Won't work. Instead, you should use the following code (place it in your LocalSettings.php file)

Maintenance scripts (creating sitemap, etc)
You won't be able to run maintenance mediawiki scripts in safe mode. But there are several workarounds. For example, even if you can't generate sitemap using shell scripts, you still can use specialized extension (for example, Extension:ManualSitemap‎).

Other issues
Thumbnails are the only thing which still shouldn't work in wiki after you changed everything above. There are several options for enabling thumbnails. For example, you can generate thumbnails on every client request, instead of generating and writing them to thumbs directory. To do it, place the following in LocalSettings.php If you want other solutions to this issue, please read the article linked to in the bottom of the page.

Fix for thumbnails
Upgrade file includes/filerepo/File.php, change: and

Make sure directorys images and images/thumb</tt> are writable.