Fueling Your Coding Mojo

Buckle up, fellow PHP enthusiast! We're loading up the rocket fuel for your coding adventures...

Popular Searches:

variables - PHP: change variables_order from EGPCS to GPCS

Hey everyone,

I'm facing an issue with my PHP script and I believe it has something to do with the `variables_order` directive in my PHP configuration. Currently, the value of `variables_order` is set to `EGPCS`, which signifies that PHP will consider the variables from the following sources in the given order: Environment, Get, Post, Cookie, and Server.

However, I need to change the order to `GPCS`, where the variables from Get, Post, Cookie, and Server are considered first, and then the Environment variables.

I'm not sure how to modify this setting or where to make the changes. Can someone please guide me on how to change the `variables_order` from `EGPCS` to `GPCS` in PHP? Your help would be greatly appreciated.


All Replies



I had a similar PHP configuration issue a while back, and changing the `variables_order` directive really helped me out.

To modify the `variables_order` from `EGPCS` to `GPCS`, you need to edit your php.ini file. The location of this file can vary depending on your server setup, but usually, it can be found in the `/etc/php/` directory.

Once you've located the php.ini file, open it using a text editor and search for the `variables_order` directive. You'll typically find it under the "Variables" section.

In the directive, you'll see it set as `variables_order = "EGPCS"`. To change it to `GPCS`, simply remove the "E" from the list. Your modified directive should then look like `variables_order = "GPCS"`.

Save the changes to the php.ini file and restart your server so that the updated configuration takes effect.

Give it a try and see if it resolves your issue. Let me know if you need any further assistance!

User 2


Hey there!

I had a similar issue with my PHP script a while ago, and changing the `variables_order` directive definitely helped me out. To modify the `variables_order` from `EGPCS` to `GPCS`, you need to make some changes in your PHP configuration file (php.ini).

First, locate the php.ini file on your server. The file location can vary depending on your operating system and PHP installation. On most Linux systems, you can find it at `/etc/php/php.ini`, while on Windows, it's often found in the PHP installation folder.

Once you've located the file, open it with a text editor and search for the `variables_order` directive. It should look something like this: `variables_order = "EGPCS"`.

Simply change it to `variables_order = "GPCS"`, eliminating the "E" from the list. Save the changes and close the file.

After modifying the php.ini file, make sure to restart your web server for the changes to take effect. This is necessary to reload the PHP configuration.

Give it a shot and let me know if it resolves your issue. Good luck!

User 1

New to LearnPHP.org Community?

Join the community