Downsides to upgrading to PHP5 / mySQL5?

Metro2

Well-Known Member
May 24, 2006
530
76
178
USA
cPanel Access Level
Root Administrator
I'm currently running with mysql 4.0.27-standard and php 4.4.7 , and I was just wondering if there are any downsides to upgrading to 5.x on both, and if it matters which version of apache I'm running (this is on RHEL 3 and 4 boxes).

Thanks for any tips / advice / opinions!
 

gribozavr

Member
Aug 15, 2007
23
1
53
Yes, there are problems with character encodings when updating from MySQL 4.0 to 4.1+. MySQL starting from 4.1 demands every script to tell it in what encoding it sends/receives data. Everything seems OK with Latin alphabet, but national alphabets, for example, Russian in CP1251 encoding, is displayed as ???.

The fix was to add after every mysql_connect()
mysql_query("set names cp1251;");

It had to be done for every client's website which had Russian text in the database and didn't explicitly declare encoding (most average PHP programmers don't know about this issue and just ignore the encoding problem).
 
Last edited:
  • Like
Reactions: Metro2

trevHCS

Well-Known Member
Nov 1, 2003
69
1
158
The only things I found with PHP5 were:-

- array_merge() throws errors if you send it only 1 array. In PHP4 is simply outputted the first array again, but in PHP5 it throws a warning and can mess things up.

- Watch out if you do any include("http://www.example.com/script.php"); type calls, you need to add a new line to php.ini which is: "allow_url_include = On". Without this URL calls in include() won't work.

- Finally, be careful with function calls. In PHP4 if you declared a function twice then it just seemed to ignore this, but in PHP5 it doesn't and it'll fall over. I assume if you run your scripts with error_reporting(E_ALL); set then these will show in PHP4, but this can be a pain in 3rd party scripts too.


It's probably also a good idea to go into PHP Config Editor in advanced mode and just save it as that seems to fill in some of the blanks and missing bits. However if you do that you'll probably need to edit php.ini (usually at /usr/local/lib/php.ini ) and sort out the error_reporting line.

The editor messes this up and will write it as...
error_reporting = "E_ALL & ~E_NOTICE"

...whereas it should be that without the quotes...
error_reporting = E_ALL & ~E_NOTICE


Trev
 
  • Like
Reactions: Metro2

trevHCS

Well-Known Member
Nov 1, 2003
69
1
158
One option depending on the complexity of your sites is to find a host who's running PHP5 and open an account with them, then test it. Admittedly this is easier said than done depending on configs etc. but might allay any worries about it all going bang.

Trev
 

bin_asc

Well-Known Member
Jul 18, 2005
280
0
166
A step to upgrade to php5 is needed, as support will be bailed out on PHP4 ... so better to have your clients upgrade from now than when php4 is totally unsuported. Maybe do a combo php4 and 5 install and clients can use .htaccess directives to use php5 as default, in case they want to test the scripts.
 

trevHCS

Well-Known Member
Nov 1, 2003
69
1
158
Can you do the split PHP4 + 5 currently except on the less reliable builds? I've heard on here that it's coming in the stable and release builds, but not sure exactly when and there seem to be a lot of people having problems with some of the "current" ones.

Wish I'd thought of that however before doing it... :)

Trev
 

bin_asc

Well-Known Member
Jul 18, 2005
280
0
166
There are tutorials here on cPanel on how to do the combo. You don`t really need EA3 to do it. Search on the forum.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Can you do the split PHP4 + 5 currently except on the less reliable builds? I've heard on here that it's coming in the stable and release builds, but not sure exactly when and there seem to be a lot of people having problems with some of the "current" ones.

Wish I'd thought of that however before doing it... :)

Trev
Updated release information for EA3 (Stage 2) can be found on http://www.cPanel.net/cpanel11