Unstoppable Domains

.htaccess and register_globals

Spacemail by SpaceshipSpacemail by Spaceship
Watch
Impact
111
Hello...

For OsCommerce to work, apparently one needs to enable register_globals. (??? What were they thinking ???) Anyway, been trying various methods in .htaccess to do this:

Code:
<Directory "/home/aether/public_html/shoppingcart">
   AllowOverride All
   php_admin_flag register_globals on
   php_admin_flag register_long_arrays on
</Directory>

These cause Misconfig 500 errors.

Have also tried:

Code:
php_value register_globals 1

Also error 500.

Any other ideas? I'm running CentOS. .htaccess definitely works, because I've used mod_rewrite... among other things.

Thanks.
-mholt
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
if you have ssh access, edit php.ini
find this line:
register_globals = Off
change to:
register_globals = On

php.ini is usually located on /etc
 
0
•••
Sorry, should have clarified: I don't want every CPanel account to have register_globals on, just one. Changing php.ini would modify the setting server-wide, which is an uber-no-no. Thanks for the response, but that's not what I want to do. Is there anything else in .htaccess that I should set?
 
0
•••
try adding this on your .htaccess on a folder
Code:
php_admin_value register_globals On
 
0
•••
Hmm nope, gives a Server misconfig error again.

Also tried changing "On" to "1". Didn't work.
 
0
•••
In the header or functions file of oscommerce place this:

PHP:
ini_set('register_globals', 'on');

register_globals can also be emulated using this code:

PHP:
// Emulate register_globals
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
}
 
1
•••
try putting
Code:
register_globals = On
or
Code:
php_flag register_globals On
 
1
•••
Have you tried creating a php.ini file and putting the directive into that. If I remember correctly if you have safe mode enabled php directives need t be in the php.ini file.

If this is the case you do not edit the main php.ini file you create a new 1 and enter the options into tha and place it in the root folder for that hosting package.
 
1
•••
Using ini_set is not going to work, because by the time the script is executed, register_globals was already applied to the script. See: http://us2.php.net/manual/en/function.ini-set.php#19874

Tree: That second method would be great, and thanks for that code, except the shopping cart will display an error if the whole setting is 0 / off. I suppose we could just disable the display of that error and put that script on each page, though. Still an option.

Weblord: I can't edit the php.ini file, because I need this to apply only to the one cpanel account.

peter@flexiwebhost said:
Have you tried creating a php.ini file and putting the directive into that. If I remember correctly if you have safe mode enabled php directives need t be in the php.ini file.

If this is the case you do not edit the main php.ini file you create a new 1 and enter the options into tha and place it in the root folder for that hosting package.
Interesting indeed! I will investigate using safe mode in the main php.ini and try this method. Thanks.
 
0
•••
peter@flexiwebhost said:
Have you tried creating a php.ini file and putting the directive into that. If I remember correctly if you have safe mode enabled php directives need t be in the php.ini file.

If this is the case you do not edit the main php.ini file you create a new 1 and enter the options into tha and place it in the root folder for that hosting package.
I wouldn't recommend safe mode. I believe using suExec offers this option, which would be better than enabling safe mode.
 
0
•••
yes by all means. My post wasn't to recommend the option but rather to point out it is housed in a php.ini file if you are using safe mode. The op should look to see if he hs that enabled.
 
0
•••
After much deliberation, I've decided to advise the guy using OsCommerce to use a different shopping cart package. OsCommerce is disgusting. :p
 
0
•••
that's better, i hope these issues will get resolved for you the soonest.
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back