How to Enable PHP with register_globals Turned On
The register_globals setting was used in older PHP applications to automatically create global variables from request data (GET, POST, COOKIE, etc.). This feature has been deprecated since PHP 5.3 and completely removed in PHP 5.4 and later because it introduces serious security risks.
Some legacy applications, older CMS systems, or custom scripts may still require register_globals to function. If you must enable it for compatibility reasons, you can try enabling it at the account level using .htaccess.
Enable register_globals Using .htaccess
Follow these steps only if you are running a PHP version that supports this directive (PHP 5.3 or earlier):
- Access your hosting account via the cPanel File Manager or FTP.
- Navigate to your public_html folder.
- Open or create a file named .htaccess.
- Add the following line to the file:
php_flag register_globals on
- Save the file and refresh your website.
Important Notes & Compatibility
register_globalsis not supported in PHP 5.4+. If your server is running a newer PHP version, this directive will not work.- On modern hosting environments, attempting to enable it may cause 500 Internal Server Errors.
- If your application requires
register_globals, you may need to switch to an older PHP version (if available) using:- cPanel → Select PHP Version
- cPanel → MultiPHP Manager
Recommended Alternative (More Secure)
Instead of enabling register_globals, update your script by replacing global variable usage with secure PHP superglobal variables such as:
// Old insecure method:
$userid;
// Modern secure method:
$userid = $_GET['userid'];
This ensures that data is properly validated and does not create unintended variables in your application.
Security Warning
Enabling register_globals is strongly discouraged. It allows external data to overwrite internal variables, making your site vulnerable to:
- Variable injection attacks
- Session hijacking
- Unauthorized access
- Data corruption
- Code execution exploits
Whenever possible, update or replace outdated scripts rather than enabling this deprecated setting.
If register_globals Still Does Not Work
- Your hosting provider might be blocking unsupported directives for security.
- Your server may be running a PHP version where the directive is removed.
- You may need developer assistance to update your script to run without it.
If you need help checking your PHP version or updating legacy software, please contact support.