Skip to content
PHP Logo

What are the potential security risks of using register_globals = on in PHP?

When register_globals is set to "on" in PHP, it can lead to security vulnerabilities such as injection attacks and unauthorized access to variables. To mitigate these risks, it is recommended to turn off register_globals and instead use superglobal arrays like $_GET, $_POST, and $_SESSION to access user input and other variables.

php
// Disable register_globals in php.ini
register_globals = Off;