Sửa lỗi register_globals is disabled in php.ini please enable it năm 2024

It is a way better practice if we use do not use register_globals. If you try to avoid this error you will have to go through lots of change. though you are beginner which mean you are learning. I would suggest you to remove the line from your php code.

now what does it do: Say you have a from with two input field name and age. when you submit and if your register_globals function is called your php will create two variable name: $name, $age and will set the value from the form field. example:

<form method="get"> <input name="name"> <input name="age"> <input type="submit"> </input></input></input></form>

you will also get a variable name $submit

now what's wrong with this: a request can come in two way : 1. POST Method 2. GET Method in both case register_globals will create variabls. but you would never know how it came. is this a problem? in cases it is. but read more you will get more problem

Register_globals also register $_SESSION, $_COOKIE, $_HEADER, $_ENV

So perhaps your data will easily be overlapped with other data. Actually one data will be lost.

what would you use instead of register_globals? $_GET for get method $_POST for post method $_SESSION for session data; it also has other related function $_COOKIE for cookie data; it also has other related function $_HEADER for header data $_ENV for environment related data

This article describes how to enable and disable the register_globals directive in a custom php.ini file.

The information in this article only applies to certain types of hosting accounts. To determine whether or not the information below applies to your account, please see this article.

This article assumes that you have already set up a custom php.ini file on your web site. If you have not already set up a custom php.ini file, please read this article first.

This article only applies to PHP 5.3 and earlier versions. The register_globals directive was removed in PHP 5.4.

Using the register_globals directive

The register_globals directive is disabled by default. You should be aware of the security implications of enabling the register_globals directive. For more information, please visit http://php.net/manual/en/security.globals.php.

When the register_globals directive is enabled, PHP creates variables automatically from HTML form parameters and cookie data. To enable this functionality, use a text editor to modify the register_globals directive in the php.ini file as follows:

register_globals = on

To disable this functionality, modify the register_globals directive in the php.ini file as follows:

register_globals = off

To verify the current value of the register_globals directive and other directives, you can use the phpinfo() function. For more information, please see this article.

I spent a beautiful Saturday addressing a multitude of problems of various deprecated features in this new php 5.3

By the way, in my php.ini, i have the line:

register_globals = on

and no problem with that.