PHP Register_Globals and Register_Long_Arrays

by damonp on January 9, 2007

in PHP

After upgrading several servers to PHP5 a few older versions of popular applications started giving odd errors. Register_globals has been configured off by default for security reasons since early PHP4. Applications that rely on register_globals all had .htaccess files enabling it for the subdirectory only. The errors we were seeing were similar though, data didn’t appear to be passing through a form post.

With a little research inside the PHP5 php.ini file, I found a related parameter, register_long_arrays. This parameter turns on legacy support for the long PHP parameters $HTTP_POST_VARS, $HTTP_GET_VARS, etc. which have since been supplanted by $_POST, $_GET, etc.

Dropped the following into the .htaccess file and all is well:

php_flag register_long_arrays on

More info:
http://www.php.net/manual/en/ini.core.php#ini.register-long-arrays

Popularity: 10%

Most Popular Posts

Damon Parker is a freelance sysadmin and web developer in Texas. He specializes in server setup, server security and high performance server configurations. Need help setting up a web server or getting a server back online after a crash or hack? Email Damon

Leave a Comment

Previous post:

Next post: