Can't set "register_globals=off", no access to .htaccess and no php.ini

Can't set "register_globals=off", no access to .htaccess and no php.ini

by Rod Simpson -
Number of replies: 11

Hi,

I'm trying to setup Moodle on my names.co.uk shared hosting and the install wont let me continue due to  "register_globals" being "on". I've spoke to tech support and they say there's no way of disabling it. I also don't have access to the php.ini and that function is allowed in the .htaccess on their Zeus servers.

I've read that the devs have disallowed Moodle installation if this is enabled and was wondering if there was a hack or some sort of workaround for this.

Also what are your views on installing 1.5 (when this requirement wasn't in place)? This could be a possibility if the devs are going to allow installation with register_globals in the future.

Any help would be appreciated.

Regards,

Rod

Average of ratings: -
In reply to Rod Simpson

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Change hosts.... it's madness having register_globals on.... really!!
In reply to Howard Miller

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by john mcgrath -
I have set register_globals off and it can be seen in the php info readout here

rgsettings.JPG

Yet I still get this warning here:

The warning is obviously wrong as the pre- install checklist also gave me all happy ticks for everything including register_globals off. I think this bit of code is not checking the configuration of the moodle directory but of something higher up the chain. Any suggestion as to how to fix appreciated - the service provider (1&1) will not switch register_globals off at the top level but leaves customers to switch it off themselves only for their directories - which I have done
rgwarning.JPG
In reply to john mcgrath

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I do not think this is a bug in moodle code, what could we probably do wrong in ini_get('register_globals') ?

This could be caused by buggy PHP or some weird PHP configuration/tweak by admin that affects the functioning of ini_get().

In any case turning on register globals for everybody on a shared server is extremely silly.


In reply to john mcgrath

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Richard Enison -
JM,

What version of PHP are you using? If it is PHP4, you need a php.ini file with register_globals=off in every directory that has .php files in it.

RLE
In reply to Richard Enison

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini - register_globals message problem solved

by john mcgrath -
Thanks very much to both of you for such quick replies. I uploaded an .htacess file with the line:

AddType x-mapp-php5 .php

and the error message has gone so it must have been a PHP4 issue. I actually didn't think moodle would run with php4 and had assumed it was php5.

Problem solved - thanks again.
In reply to Rod Simpson

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Aakif Tanveer -
hi...
my domain is also hosted by names.co.uk.. is there any possible workaround to this problem (apart from changing host)??
they r using php 4.4.8
thanks!
In reply to Aakif Tanveer

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Richard Enison -
AT,

Have you tried either
  1. doing what JM did (forcing the use of PHP5, assuming it is available at names.co.uk), or
  2. since PHP4 requires a php.ini file in every directory that contains .php script files for it to be effective in all of them, doing what I suggested earlier in this thread, namely, putting such a file, containing register_globals=off, in every Moodle directory? There is a PHP script that will do that automatically at http://tips-scripts.com/php_ini_copy.
If neither of those works, change hosts.

RLE
In reply to Aakif Tanveer

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Timothy Takemoto -
The way that worked for me is to create a .htaccess file in the main moodle directory containing  

php_flag register_globals   0

In reply to Timothy Takemoto

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Donald Cherry -
This is my first post here. I'm one inch above a newbie, so I ask for your patience. I am also having this problem with trying to set register_globals=off. I am frankly in a little over my head, so I may be making a very foolish mistake. I will explain in what may seem like painful detail to some of you Moodle experts out there.

I have Moodle version 1.9.4. Just upgraded (had my hosting company, Siteground, do it for me). It would appear that I have php 5.1, as this is listed at the top of my .htaccess file.

I have used my hosting company's Cpanel/file manager/edit file to add a line to my .htaccess file. I have tried
register_globals=off
register_globals = off
php_value register_globals off

I have also tried the above with a "0" in place of the "off."

Each time, when I go to my site, I get an internal server error, and am unable to access the site.

Any help is warmly welcome and appreciated!
In reply to Donald Cherry

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Donald Cherry -
Just thought I'd let you know what my hosting company, Siteground, just told me. They said I had PHP 5.1.6, which has register_globals enabled by default. Said they replaced it with PHP 5.2.5, which has register_globals disabled by default. All is well.
In reply to Donald Cherry

Re: Can't set "register_globals=off", no access to .htaccess and no php.ini

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Just for the record, the (correct) line working for me in the .htaccess file is (for an Apache 2.0.52 web server) :

php_flag register_globals off

If that leads to a "Internal Server Error (HTTP 500), it could be that the web server process is refusing such locally assigned directives (i.e. via .htaccess files). To be sure, you should check the web server error log.