Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Server Requirement Error: register_globals is disabled in your PHP configuration..


sandras

Recommended Posts

we updated php version from 5.4 to 7.0 and got following error while accessing the site:

Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.

 

Then rolled back to php 5.4 version but still same error occurs. Then changed in php.ini file globals to on mode and added .htaccess file with following :

# Override PHP settings. The first IfModule is

# for Apache 1.3, the second for Apache 2. 
 
<IfModule mod_php4.c>
  php_value register_globals 1
</IfModule>
 
<IfModule sapi_apache2.c>
  php_value register_globals 1
</IfModule>
 
php_flag register_globals 1
 
but error still occurs. what shall I do to get site up and running again?
Link to comment
Share on other sites

You can try adding the line below after the error_reporting line in includes/application_top.php file. But, at best, all that does is hide them. It is important to understand that register globals was removed from php, which is why you are seeing those messages, because it was a security issue and that will still be present. Ideally, you should upgrade your version of oscommerce to the Bootstrap version. Short of that, there are fixes that be applied to the code to allow the shop to run under 5.4.

 ini_set('display_errors','0'); 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If your store requires register global variables, you must be running an absolutely ancient version of osC (2.2MS2?), or else an add-on or custom code that requires that setting. As Jack said, you must upgrade immediately to a current version of osC and add-ons/current code, preferably 2.3.4BS, Jumping from PHP 5.4 to 7.0, you'll probably encounter lots of other code problems.

 

BTW, your use of php_flag and php_value in .htaccess shows that you have no idea what you're doing. That setting belongs in php.ini (or the equivalent).

Link to comment
Share on other sites

Hi, Thank you for advices. You`re right, that store was on very old version (2.2) and we are building the new store already, we just need the old be up another week before the new is ready..and about .htaccess file I don`t have an idea what to do, that`s why I asked help here. The code I added, was the one I found from the forums and was suggested by someone. If that is wrong, can you recommend, what would be right to write there? @@Jack, I tried to add ini_set('display_errors','0'); but it did not help. I don`t know if because my .htaccess code was wrong or I did put that line to wrong place. However I tried to add it // set the level of error reporting

and also after: 

 

// check if register_globals is enabled.

// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
  if (function_exists('ini_get'){
    ini_get('register_globals'or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');
  }

I also removed that code from .htaccess and had in php.ini is only register_globals = Off
   

Link to comment
Share on other sites

Those were very obsolete instructions. First of all, I don't even think PHP 7 wants to see a setting for register_globals (AFAIK, it's been removed). It's just off permanently. If you absolutely cannot set register_globals on PHP 7, can you temporarily roll back to PHP 5.4 (or earlier), where it's possible? That could tide you over for a while as you implement an up-to-date osC version. If you need to get osC 2.2 MS2 running on PHP 7, you can do it, but it will require many, many code changes. It's not just adding $var = $_REQUEST['var']; for each register global used -- you will have session problems and probably some other problems. You'd do a lot better to put your time and effort into getting osC 2.3.4BS "Edge" up and running, and accept that your store will be down for a few days. Note that a few minor changes may still be needed for PHP 7, even with this latest osC.

 

Setting display_errors to 0 won't affect this message from osC -- it's for system error messages.

 

You would make the register_globals setting only in php.ini (or some equivalent -- ask your host), not in .htaccess. Note that some hosts require an entry in .htaccess to tell PHP where to find php.ini, such as suPHP_ConfigPath -- ask your host.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...