Post by neophit » Sun Sep 09, 2007 7:45 am

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".

Newbie

Posts

Joined
Wed Sep 05, 2007 2:28 am

Post by neophit » Sun Sep 09, 2007 7:46 am

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.

Newbie

Posts

Joined
Wed Sep 05, 2007 2:28 am

Post by neophit » Sun Sep 09, 2007 7:47 am

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)

Newbie

Posts

Joined
Wed Sep 05, 2007 2:28 am

Post by Daniel » Sun Sep 09, 2007 9:38 am

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.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by neophit » Sun Sep 09, 2007 10:40 am

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.

Newbie

Posts

Joined
Wed Sep 05, 2007 2:28 am

Post by tchemis » Sun Sep 09, 2007 10:48 am

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) 

Active Member

Posts

Joined
Tue Aug 21, 2007 9:23 am

Post by d77 » Mon Sep 10, 2007 1:26 am

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

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by nobi » Sun Sep 16, 2007 9:44 pm

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. 
Last edited by nobi on Sun Sep 16, 2007 9:49 pm, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 15, 2007 12:55 am

Post by d77 » Sun Sep 16, 2007 9:52 pm

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.
Last edited by d77 on Sun Sep 16, 2007 10:16 pm, edited 1 time in total.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by nobi » Sun Sep 16, 2007 10:24 pm

thanks, but do I have ot write the following words as well??

php.ini:

Newbie

Posts

Joined
Sat Sep 15, 2007 12:55 am

Post by d77 » Sun Sep 16, 2007 10:30 pm

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 :)

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by nobi » Sun Sep 16, 2007 11:12 pm

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.
Last edited by nobi on Sun Sep 16, 2007 11:14 pm, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 15, 2007 12:55 am

Post by d77 » Sun Sep 16, 2007 11:21 pm

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.
Last edited by d77 on Sun Sep 16, 2007 11:23 pm, edited 1 time in total.

User avatar
d77
Active Member

Posts

Joined
Sat Apr 14, 2007 8:04 am

Post by nobi » Mon Sep 17, 2007 12:00 am

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..

Newbie

Posts

Joined
Sat Sep 15, 2007 12:55 am
Who is online

Users browsing this forum: No registered users and 3 guests