In order to experiment with new versions (I have many custom extensions), I have mediawiki installed in /var/www/html/my-mediawiki. Inside it, include /var/www/html/my-mediawiki/includes is a symlink that points to /var/www/html/mediawiki-x.yy.z/includes.
In this scenario the $IP variable is wrongly calculated, because in line 54 of includes/WebStart.php:
$IP = dirname( __DIR__ );
$IP becomes /var/www/html/mediawiki-x.yy.z/, while it should be /var/www/html/my-mediawiki. This happes because dirname doesn't care about symlinks.
A workaround is to change that line to
$IP = dirname( $_SERVER["SCRIPT_FILENAME"] );
and $IP gets the correct value in every situation