Page MenuHomePhabricator

Problems when ini_set() is disabled
Closed, DeclinedPublic

Description

Author: ttasarimgroup

Description:
i have a problem with the installation of mediawiki 1.4.2 to the internet. i can
install it on my computer quite well and can use it, but when i want to try it in the
internet i face with three problems :
(1.) After "You'll have to set the wiki up first!" page, i see warnings and a fatal
error:

Warning: ini_set() has been disabled for security reasons
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia1/config/index.php on
line 117

Warning: main(includes/Defines.php): failed to open stream: No such file or directory
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia1/config/index.php on
line 121

Fatal error: main(): Failed opening required 'includes/Defines.php'
(include_path='.:')
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia1/config/index.php on
line 121

i could have been able to pass the problem by hacking the codes in config/index.php --
i have changed the relative addresses of include or require pages with putting ../
before the pages.

Then the second problem comes :

(2.) in the installation process, the last requirement(!) wanted to be fulfill, but i
dont have a root access due to hosting company does not give them. From here, the
mediazilla, i have seen a clue to hack the config/index.php file by changing the
DBuser and DBpasswords with my accounts in database. Therefore the installation
process was finished.

At the end of the installation process i have seen the note to copy the
config/LocalSettings.php file to the main root of the wiki. i did. and change the
permissions of the config folder to 0 pr 400, i think i is not problem.
Then faced with the 3rd problem :

(3.) when i open my site, i see the below warnings :

Warning: ini_set() has been disabled for security reasons
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php on
line 8

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 383

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 316

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 344

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 345

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 347

Warning: Cannot modify header information - headers already sent by (output started
at /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/LocalSettings.php:8)
in /usr/hosts/domains/tawish/www.tawish.org/httpdocs/tatarpedia/includes/OutputPage.ph
p on line 396

And can not overcome the problem for several days. Is there anybody to help me, and
solve the problem.. What can i do, i am not a programmer, but only a person who wants
to upload mediawiki to the internet and share documents, articles with other people
like wikipedia.

Thanks a lot for your help..


Version: 1.20.x
Severity: normal

Details

Reference
bz1965

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 8:19 PM
bzimport set Reference to bz1965.
bzimport added a subscriber: Unknown Object (MLST).

jeluf wrote:

Is there a way to change the include path without calling ini_set?

There is a set_include_path() and get_include_path() as of 4.3.0. We could perhaps try
using it if available.

ttasarimgroup wrote:

i have put # before ini_set( "include_path", ... in LocalSettings.php and it worked, but from
the beginning to now. i have always omitted some needed (i think) rows so my site is may have
problems in the future.. does not seem so for now..

thanks a lot..

ezo wrote:

Disabled ini_set()

If the php-function ini_set() has been disabled for security reasons you have to
change some paths. The row-numbers are for version 1.5.1. In the file
config/index.php:

  • 122: require_once( "includes/Defines.php" ); => require_once( "../includes/Defines.php" );
  • 123: require_once( "includes/DefaultSettings.php" ); => require_once( "../includes/DefaultSettings.php" );
  • 124: require_once( "includes/MagicWord.php" ); => require_once( "../includes/MagicWord.php" );
  • 125: require_once( "includes/Namespace.php" ); => require_once( "../includes/Namespace.php" );
  • 166: require_once( "install-utils.inc" ); => require_once( "../install-utils.inc" );
  • 167: require_once( "maintenance/updaters.inc" ); => require_once( "../maintenance/updaters.inc" );
  • 465: require_once( "maintenance/InitialiseMessages.inc" ); => require_once( "../maintenance/InitialiseMessages.inc" );
  • 1284: require_once( "languages/Names.php" ); => require_once( "../languages/Names.php" );

In the file includes/DefaultSettings.php:

  • 27: require_once( 'includes/SiteConfiguration.php' ); => require_once( '../includes/SiteConfiguration.php' );

Then you can run the script index.php again. Don't take notice of the fatal
error in includes/DefaultSettings.php. Just reload the page. After moving
config/LocalSettings.php to the folder above you have to comment out the
ini_set() in LocalSettings.php:

  • 8: ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages" ); => #ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages" );
  • 12: ini_set( 'memory_limit', '20M' ); => #ini_set( 'memory_limit', '20M' );

robchur wrote:

Closing due to lack of feedback for a while, and the fact that a viable
workaround exists.

janrei.g wrote:

Are there chances that MediaWiki will take care of environments where ini_set
is disabled?

There is at least a warning during install (I didn't manage to install
MediaWiki yet but this is most likely a differnt issue):
Warning: ini_set() has been disabled for security reasons in /srv/www/httpd/
phost/j/de/pytalhost/jansspielwiese/web/scripts/wikit/config/index.php on line
33

Now that we're looking to support HipHop, and HH doesn't support ini_set() for a majority of the parameters, it's a good time to take a look at all of our ini_get|sets in core and clean them up.

A general wfIniGet( $param, $defaultVal ) would be useful as a wrapper.

Installation -> General. We need to cleanup ini_set/get() everywhere.

MediaWiki 1.20.2 here with ini_set() disabled as well. One load of this wikis frontpage produces 12 lines of PHP warnings:

PHP Warning: ini_set() has been disabled for security reasons in ../includes/db/Database.php on line 702
PHP Warning: ini_set() has been disabled for security reasons in ../includes/db/Database.php on line 712
[...]

There are quite a few places where ini_set/get is used:

$ egrep -rl 'ini_[gs]et' .
./includes/AjaxResponse.php
./includes/GlobalFunctions.php
./includes/AutoLoader.php
./includes/LocalisationCache.php
./includes/StreamFile.php
./includes/OutputHandler.php
./includes/OutputPage.php
./includes/filebackend/lockmanager/DBLockManager.php
./includes/filebackend/lockmanager/MemcLockManager.php
./includes/UserMailer.php
./includes/WebStart.php
./includes/db/DatabaseMysql.php
./includes/db/Database.php
./includes/WebRequest.php
./includes/normal/UtfNormalMemStress.php
./includes/HttpFunctions.php
./includes/installer/WebInstallerPage.php
./includes/installer/Installer.php
./includes/objectcache/MemcachedPeclBagOStuff.php
./includes/parser/Preprocessor_DOM.php
./includes/specials/SpecialUpload.php
./includes/upload/UploadFromFile.php
./includes/ScopedPHPTimeout.php
./maintenance/deleteImageMemcached.php
./maintenance/dev/includes/router.php
./maintenance/Maintenance.php
./maintenance/preprocessorFuzzTest.php
./maintenance/backup.inc
./maintenance/backupTextPass.inc
./tests/parser/parserTest.inc
./tests/phpunit/includes/parser/NewParserTest.php
./tests/selenium/SeleniumTestConsoleLogger.php
./profileinfo.php

tstarling subscribed.

Closing, since I don't think it is reasonable to require support for such an environment. There is obviously not much interest from developers.

In T3965#60939, @demon wrote:

Now that we're looking to support HipHop, and HH doesn't support ini_set() for a majority of the parameters, it's a good time to take a look at all of our ini_get|sets in core and clean them up.

HHVM eventually did implement most of them.