Register Globals

Register Globals

by Luiz Blind -
Number of replies: 5

Hi!

First, is there a way to stop this annoying moodle favicon.ico download everytime i load one of moodle.org's page? I have already 20 favicon.ico in my download folder! surprise (even to insert this emoticon I had to download the 21th favicon...)

Also, I can't install moodle properly. I already read more than 10 documentations about editing php.ini to set register_globals = Off, but it seems that moodle require that php.ini in EVERY folder/subfolder and I just can't do it.

I uploaded php.ini to every folder and could finish the instalation, but when I was testing moodle, the problem appeared again. That's why I'm thinking I have to put php.ini in the subfolders and sub-subfolders... and that doesn't seem right.

Am I doing something wrong?

My version is: moodle-latest-23.zip (seems to be 2.3 version)

Thanks a lot for your time!

Average of ratings: -
In reply to Luiz Blind

Re: Register Globals

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

You absolutely don't have to put a php.ini in every folder. Usually there is just one for the whole Apache server.

And the favicon issue is here:  MDLSITE-1860   (It's not Moodle, it's something to do with Cloudflare we think)

Average of ratings: Useful (1)
In reply to Martin Dougiamas

Re: Register Globals

by Luiz Blind -

(33 favicon icons right now.. hope it stops soon!)

Yes, I know it sounds weird... but I had to put php.ini in every main directory to install Moodle.

Initially, I put it only in the main directory, then I ran phpinfo() and it said my register_globals were off. But moodle was still saying that I had to set register_globals off.

It took me hours reading and searching about this problem and no solution worked for me. I saw people saying that this "problem" came with this version. Also saw people saying that I had to put php.ini in every directory... but that doesn't seem right.

Anyone have a clue about it?

In reply to Luiz Blind

Re: Register Globals

by Yunuen Carrillo -

I do not have a straight answer to your questions, I just wanted to say that I am doing also the same task. I copied the php.ini file in every main directory and the installation went though. However I am noticing that there are actions that cannot be performed because the php.ini file is not in the subdirectory, therefore my task for the last 2 afternoons is copying the php.ini file   in every single directory, to me it seems a ridiculuos task, but it is all I have found so far. I would appreciate some advice on this also. 

The instruction on my php.ini file is 

mysqli.default_socket = /tmp/mysql5.sock, because the config.php file did not accept the socket declaration.

As soon as I put the php.ini in the directory, my moodle manages to complete the requested task.

For the globals it was enough to declare it on the php.ini at moodle root level.

my moodle version is 2.2.4, hosting on 1and 1, using  php5

might be good if moodle developers create a solution for this cases.

Average of ratings: Useful (1)
In reply to Luiz Blind

Re: Register Globals

by Yunuen Carrillo -

HI, 

I tried to modify my .htaccess to accept the instruction

php_value mysqli.default_socket = /tmp/mysql5.sock, but it would show a 500 internal error on my moodle. so, I removed it. 

The solution in my case was to write on my config.php file the following:

ini_set('mysqli.default_socket', '/tmp/mysql5.sock');

just above the section for the $CFG

$CFG->dbtype = 'mysqli'; 
$CFG->dblibrary = 'native'; 
$CFG->dbhost = 'localhost';

I think it wouldalso  work if I declare  'dbsocket'  => '/tmp/mysql5.sock' on the $CFG->dboptions array.

This makes me think that you could try to declare something similar to register globals, I think the instruction could be  ini_set('register_globals',true);

Hope it works! I am just guessing for your case, I am not an expert.

In my case worked and I  do not have to copy anymore the php.ini file on every folder! smile

In reply to Yunuen Carrillo

Re: Register Globals

by Luiz Blind -

Hey, Yunuen.

Thanks a lot for your time!

Actually, it sould be, in my case, ini_set('register_globals',false);

But I already tried this... and the htaccess solution too. They won't work...

The only thing that worked was to put php.ini in every folder. But I grew tired of doing it and gave up. I saw other ppl with the same problem and I can't believe they do not have a solution.

I even tried this to emulate register globals = off:

if (ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
foreach ($superglobal as $global => $value) {
unset($GLOBALS[$global]);
}
}
ini_set('register_globals', false);
}

Won't work too...