After a recent update (to system and mediawiki), my Mediawiki is basically completely blank. The database and everything seems to be intact though. After enabling php debug output, I get the following message
Warning: is_executable(): open_basedir restriction in effect. File(/usr/bin/php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/var/lib/mediawiki/) in /usr/share/webapps/mediawiki/includes/Wiki.php on line 655
My question is how I go about and resolve this? Simply adding /usr/bin/php to my open_basedir() restriction seems pretty unsafe.
It appears that the error occurs in MediaWiki::doJobs(), which tries to start a separate PHP process to handle the job queue asynchronously in the background. To fix it, you could:
edit your php.ini to add /usr/bin/php to the allowed paths,
set $wgJobRunRate = 0 in your LocalSettings.php to disable automatic job processing entirely, and run maintenance/runJobs.php via cron instead, or
set $wgPhpCli to point to some file which is allowed under use_basedir but is not an executable program, which should cause the is_executable() check to fail silently and force MediaWiki to fall back to synchronous job processing.
Note that the last option, while simplest, can have performance issues, since it means that MediaWiki needs to run background jobs at the end of normal web request processing, potentially increasing page load times.
That said, if you don't want to use the first option, combining the latter two might be safest and most efficient: running background jobs through cron takes them out of the normal request handling path, while setting $wgPhpCli to a dummy value ensures that MediaWiki won't try to start background PHP processes for any other purpose either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With