08-24-2007, 11:49 PM
Hello. I recently switched web hosts, and I uploaded all of my PHP scripts exactly the same as on my old site, but for some reason most of them don't work. The version isn't too different...my old host had 4.4.7 and my new one had 4.4.6 until they changed it to 5.1.6. It may be that all scripts with mySQL don't work, but I'm not sure, and I am connected to the database properly. If you have any ideas of what may be going on, please let me know. Thanks in advance!
08-24-2007, 11:59 PM
It could be any number of things, and it would be impossible to say for sure with the information you provided.
You mention potential problems with scripts involving MySQL. Although you are connected to the MySQL server properly, are your scripts? Have you verified that the login information for each of these scripts is still valid with your new hosting setup (db user names, db passwords, etc)?
Do your scripts rely on register_globals being on but your new host has them set off?
Do your scripts rely on short php tags where your new host requires long tags?
to mention but a few
08-25-2007, 12:00 AM
When a script does not work between different servers or due to a version upgrade, 99% of the time it is due to configuration difference and 1% of the time it is actually due to version differences.
There are likely runtime errors being generated that will help point to where the problem is. Either check your web server log for errors and/or turn on full php error reporting (display_errors to on and error_reporting to E_ALL) in a .htaccess file.
I suspect register_globals, but if it seems to be limited to database access, the hostname in your database connection details is probably different.
At what point did your scripts stop working? When you moved to the new host or when he upgraded to PHP5?
08-25-2007, 12:27 AM
The scripts stopped working when I switched to my new host. Some of the scripts seem to work halfway, but anything involving mySQL seems to not work. Like, on my login script, the cookie that says that you are logged in gets set to TRUE, but the username cookie does not get set. And the strange thing is that all of my forums do not work except for one thread. I will try register_global settings and change my error display. Thanks for your help.
Yeah you will have to debug your coding and edit it to work with the new hosts settings
08-25-2007, 02:53 AM
I tried changing the register_globals setting and it worked. Thanks for your help everyone!
08-25-2007, 03:17 AM
Register_globals are being eliminated in PHP6, because they were a bad idea - getting the language to automatically do something that the programmer should have only done specifically when necessary. It is best if you starting finding and fixing the things in your code that are dependent on register_globals now, when you have time, rather than later when PHP6 is released and your web host upgrades and you would be forced to fix them in a hurry or move to a web host that has not upgraded yet.
Register globals were turned off by default starting in php Version 4.2.0 on 22-Apr-2002. At that point in time, php.net began recommending that no new code be written that depends on register globals being on.