Page 1 of 1

register_globals verification

Posted: Sun Sep 09, 2007 7:45 am
by neophit
I've installed OpenCart on a Linux machine (Apache+PHP+MySQL). Because I'm not the root (just a user) i had to overwrite some PHP settings, including "register_globals". I've done this with an .htacces file. There seems to be a problem with the installer, and the index.php file from the root directory. Look at my scenario:

1. i create a .htacces for my root directory

Code: Select all

php_value register_globals "Off"
2. i create a phpinfo() file to verify my modifications. It was good, the Master value is set to On, the local setting is "Off".

Re: register_globals verification

Posted: Sun Sep 09, 2007 7:46 am
by neophit
3. I've create a new file "test.php" with this simple code:

Code: Select all

<?php

echo ini_get('register_globals');

?>
The result is "Off".

4. I've tried to begin the installation of OpenCart, but the script said that the register_globals are On. I've hacked the script, so i managed to install the OpenCart.

Re: register_globals verification

Posted: Sun Sep 09, 2007 7:47 am
by neophit
5. I've tried to open the Catalog but i get, then, of course, this message:
Error: register_globals is enabled!
6. I've locate the code in the index.php file:

Code: Select all

if (ini_get('register_globals')) {
	exit('Error: register_globals is enabled!');
}
And i changed it to

Code: Select all

if (ini_get('register_globals')) {
	echo ini_get('register_globals'); echo "<br />";
	exit('Error: register_globals is enabled!');
} 
guess what:
Off
Error: register_globals is enabled!
So, there is a problem with the "if" statement... Or maybe i was all wrong.  :)

P.S. I'm sorry for writing the message this way, but i was unable to write it on a single post (i don't know why - it give me an error page)

Re: register_globals verification

Posted: Sun Sep 09, 2007 9:38 am
by Daniel
neophit wrote: 5. I've tried to open the Catalog but i get, then, of course, this message:
Error: register_globals is enabled!
6. I've locate the code in the index.php file:

Code: Select all

if (ini_get('register_globals')) {
	exit('Error: register_globals is enabled!');
}
And i changed it to

Code: Select all

if (ini_get('register_globals')) {
	echo ini_get('register_globals'); echo "<br />";
	exit('Error: register_globals is enabled!');
} 
guess what:
Off
Error: register_globals is enabled!
So, there is a problem with the "if" statement... Or maybe i was all wrong.  :)

P.S. I'm sorry for writing the message this way, but i was unable to write it on a single post (i don't know why - it give me an error page)
I think you might be getting this message because your server is not set to allow ini_set to work.

You can always changing it in .htaccess.

Is it your server or a hosting company? IF hosting change to another one if they don't disable registered globals.

Re: register_globals verification

Posted: Sun Sep 09, 2007 10:40 am
by neophit
It's not "my" server. I'm just a user (well, i have a CPanel and i manage many domains, but i'm not an admin). To change the server is not an option because i've worked with them since '95. And in Romania they are the best (or at least i'm convinced they are).

However, in the end i have this small trick of the index.php file, so the script worked after i've set register globals "off" using .htacces:

Code: Select all

if (ini_get('register_globals') == "On") { exit....
For me it works... Thank for your reply.

Re: register_globals verification

Posted: Sun Sep 09, 2007 10:48 am
by tchemis
neophit wrote: I've installed OpenCart on a Linux machine (Apache+PHP+MySQL). Because I'm not the root (just a user) i had to overwrite some PHP settings, including "register_globals". I've done this with an .htacces file. There seems to be a problem with the installer, and the index.php file from the root directory. Look at my scenario:

1. i create a .htacces for my root directory

Code: Select all

php_value register_globals "Off"
2. i create a phpinfo() file to verify my modifications. It was good, the Master value is set to On, the local setting is "Off".
Shouldn't this be

Code: Select all

 
php_flag register_globals off
Also please keep in mind, on some host the .htaccess file is only checked every couple of hours, so it might take sometime for the change to take effect (this was an issue for me several times, not sure if for you) 

Re: register_globals verification

Posted: Mon Sep 10, 2007 1:26 am
by d77
also, some hosts (like mine) do not allow php_flag's to be set in .htaccess. in my scenario, these must be set in a php.ini file like this:

php.ini:

register_globals=off

Re: register_globals verification

Posted: Sun Sep 16, 2007 9:44 pm
by nobi
my host does not allow changing globals, so how can I create tht php.ini? And where do I have to place it exactly? And is this the right code?  register_globals=off
Do I have to chnage anything else?
I use PHP5 for sure at ohost.de.
I created an PHP.ini with the windows editor (txt) and put the code in it, but it does not work.I removed then ending TXT later on, but does not work. 

Re: register_globals verification

Posted: Sun Sep 16, 2007 9:52 pm
by d77
i believe php.ini can go in the same places a .htaccess can. mine is placed right in my root.

just create it the same way you would a new .htaccess... text file called php.ini with the line i suggest.

this was just a suggestion, in my case it is what i have to do because of the way the server is configured.

if you haven't already, contact your host's support and ask them how to turn of register_globals.

Re: register_globals verification

Posted: Sun Sep 16, 2007 10:24 pm
by nobi
thanks, but do I have ot write the following words as well??

php.ini:

Re: register_globals verification

Posted: Sun Sep 16, 2007 10:30 pm
by d77
no. i should have done this:

Code: Select all

register_globals=off
i was trying to re-iterate the name of the file. sorry for my laziness :)

Re: register_globals verification

Posted: Sun Sep 16, 2007 11:12 pm
by nobi
it doesn't work, I am with a free webspace provider, I must change provider I think....
Why is it not possible to change the Opencart script as to allow the user to choose between
register-globals on or off. This would give more freedom to user. The user should be able to decide if the shop can run with globals on, as well as globals off.

Re: register_globals verification

Posted: Sun Sep 16, 2007 11:21 pm
by d77
the register_globals setting heavily influences how the entire product is coded. coding the cart with this setting turned off is a "best practice" and is more secure (really, better for opencart's users). since some people still have old code that was built around using register_globals on, many hosts will default it to on so that code does not break. they should provide you the flexibility to set it the way you want, and i think you should still be able to ask that question of a free host. might not get a speedy response though.

Re: register_globals verification

Posted: Mon Sep 17, 2007 12:00 am
by nobi
thanks, I understand now. I will rather pay for an provider than using this one I have.
I am not that serious to establish the shop right now. I just wanted to study it with that free provider and to learn its features before I get really serious about it..