February 2nd, 2013, 06:48 PM
Register Globals on my new dev server! AACK!
I just migrated my dev sever from a Windows Apache set up to an Ubuntu Apache set up with php5.
I have about 100 files that depended on on register_globals being On in the windows environment as this is a major dev project.
I cannot for the life of me enable this on the Ubuntu server.
"register_globals = On" in /etc/php5/php.ini
"ini_set('register_globals', 'On');" in one of my files to test
register_globals doesn't even show up in my phpinfo()
please help. there is no way I can go and change ALL the vars (about 500 of them) until the dev is done.
February 2nd, 2013, 06:49 PM
ini_set() won't work for this setting.
What version of PHP are you using?
February 2nd, 2013, 06:56 PM
PHP Version 5.4.6-1ubuntu1.1
PHP Version 5.4.6-1ubuntu1.1
February 2nd, 2013, 06:58 PM
register globals does not exist in php 5.4
February 2nd, 2013, 07:01 PM
so now what?
downgrade until i'm ready for production?
surely there is a better option.
February 2nd, 2013, 07:08 PM
Honestly, the best option is to fix your code. Why would you wait until you're ready for production before fixing it? What if you discover other incompatibilities with modern versions of PHP after you fix the register globals problem?
I understand it's a major project. What I don't understand is why you started a major project that relies on register globals. Register globals has been disabled by default and its use actively discouraged for the past 11 years and it has been officially deprecated for the past 3 years.
Otherwise, you can downgrade to PHP 5.3, which is the last version of PHP that will ever support register globals.
February 2nd, 2013, 07:12 PM
but the downgrade is temporary because i need to allocate my time to actual development. i will make the code conform in a few weeks when some time frees up.
February 2nd, 2013, 08:30 PM
problem is i get pear to work with the downgraded version.
need ANOTHER temporary fix.
how can install pear to work with 5.3 for a week or two untill i can get this all hammered out?
February 2nd, 2013, 09:44 PM
tools tgo fix old scripts
so are there any suggestions or tools that could help me sort through all of the code and help to find the vars that need to be adjusted?
February 2nd, 2013, 10:41 PM
Besides running the code and looking for undefined variable warnings?
NetBeans, for one IDE, can analyze the code and show warnings when you use an undefined variable.
February 3rd, 2013, 03:45 PM
It might also be worthwhile searching for <input> and <select> tags in your HTML; those will help identify which variables need to be tested.
Also make sure you have the dev copy of the site set to show E_NOTICE's; that way anytime you attempt to use a non-registered global you'll get an error message and will know that it needs updated.
The IDE suggestion is good one too. I haven't used NetBeans, but I'm pretty sure Eclipse can do this as well.
February 3rd, 2013, 03:50 PM
just about done
modifying all essential pages. just decided to bite the bullet and comply. so much for sleeping this weekend.
having major PEAR issues, will issue a new thread shortly for assistance.
thanks my friends.