I have finally started to make the move to PHP5
I have kept putting it off because my host doesnt support it but if all goes well, i'll just start the search for a new host. (any recomendations? uk based preferably)
For peoples experience how easy is it to upgrade a project from PHP4? It is OOP, or as OOP as it can be in PHP4 - however, i think this could cause the biggest problem. Since this is where the most changes are right?
The project isnt all that big, maybe ~ 3000 lines of code.
I've started playing around with PHP5 and it seems cool so far, I've done quite a bit of programming in Java and C# so some of it feels like 'finally, i can do that!' however other bits feel a bit confusing.
So... basically, any pointers to get me going? Does anybody know of any good reads out there on upgrading?
Hmm, i'm not quite sure what my question is in this post... just general advice maybe.
I believe some functions are still there but are being depreciated? so i will want to remove using these. is there a list somewhere?
Thanks in advance.Well here is the change log for PHP5 from the official PHP Manual (<!-- m --><a class="postlink" href="http://www.php.net/ChangeLog-5.php">http://www.php.net/ChangeLog-5.php</a><!-- m -->)
Note that this is extensive and will take a little while to absorbe and also remember some things wriiten in PHP 5 wil not work at all with PHP 4 since it is not necessarily backwards compatible and some things that were problems in PHP 4 have been corrected, this is a new PHP altogether and OOP is much more supported than in the PHP 4 version so if you are comfortable with PHP 5 and how the OOP functions work with it they will not work (most of the new features of OOP) in PHP 4 so get used to a long transition from one to the other and plan on altering code in some OOP cases to do what you want to do.Jesus... thats one long list.
I know its significantly different but I think it will be ok, just something for me to get used to. Afterall, the language from what i can see is still basically the same.
I guess i'll start porting my project over, i'll just start at line 1 of the index.php and go forward like that
Get read for some problems! If you don't have problems you are not HUMAN...good luck. I use it in some cases but not so much yet since most webservers still use PHP4If you're positive that you're going to upgrade, you can minimize downtime by installing a server locally (or finding a production server) with PHP5. Copy your app over to this server and start tweaking it. That way you can just upload your PHP5-compatible source to the new host.
EDIT: Forgot to add... this is also probably the best way to prepare your script for PHP5. Just throw it on your testing server and set error_reporting to E_ALL and let PHP tell you where the problems are.Cool, thanks. I had meant to ask if i should do that, wasnt sure if it was a good idea or not.
Thanks againJesus... thats one long list.You should see the changelog for PHP 4 (<!-- m --><a class="postlink" href="http://www.php.net/ChangeLog-4.php">http://www.php.net/ChangeLog-4.php</a><!-- m -->). The only part of PHP5's changelog that is really relevant when upgrading from 4 are the bits right down the bottom for the 5.0.0 versions. And not even all of that (one change reads "Fixed bug #28999 (fixed behaviour of exec() to work as it did in 4.X).")
More relevant for your purposes would be the Migration (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/migration5.php">http://www.php.net/manual/en/migration5.php</a><!-- m -->) chapter.Cool, that might be a better read! thanks Well, I tried one of my projects and ... wow. it worked.
I'm actually quite amazed, there was only one error.
I istalled WAMP (with the PHP4 addon) so i could swap between the two easily and try stuff out.
Maybe this migration wont be as bad as i thought, but i need to go through and chech its all really working still What error_reporting setting are you checking all of this under? I personally think it'd be a good idea to set the level to E_ALL and fix even warnings/notices that might not bring the script to a screeching halt.I'm on E_ALL and i'm not getting anything :S the only error had was in a class i had defined a varaible twice by mistake
ie;
class something {
var $something = "hello";
var $something = "hello";
}Ok, ive found my first thing that doesnt *need* changing but i guess i should change it.
i'm ofcourse using mysql (normal) from PHP4.
so i see i can use mysqli just like i would have with mysql in php.
OR i can create it as an object.
Is the only reason for this to allow the programmer the flexability of doing it either way? and i assume there is no difference... right?
Also, how can i take a peak at the mysqli object code?so i see i can use mysqli just like i would have with mysql in php.MySQL isn't able to communicate with more recent versions of MySQL as effectively. The dbms-specific interfaces are being downgraded in prominence in favour of PDO.mysql object code?If you mean the object that represents the database connection, it's unlikely to be implemented in PHP; you'll be looking at the application source code to track that down. On the other hand there are some .NET-style reflection classes that allow some dissection of objects.The dbms-specific interfaces are being downgraded in prominence in favour of PDO.
Intersting, it looks good ive done allot of reading on it.
However... I cant get it working on the PHP5 server i have, i keep getting the error "could not find driver"
Do i need to install it? or are the drivers included? How can i check?
Thanksfixed it! had to update my php.ini
I have kept putting it off because my host doesnt support it but if all goes well, i'll just start the search for a new host. (any recomendations? uk based preferably)
For peoples experience how easy is it to upgrade a project from PHP4? It is OOP, or as OOP as it can be in PHP4 - however, i think this could cause the biggest problem. Since this is where the most changes are right?
The project isnt all that big, maybe ~ 3000 lines of code.
I've started playing around with PHP5 and it seems cool so far, I've done quite a bit of programming in Java and C# so some of it feels like 'finally, i can do that!' however other bits feel a bit confusing.
So... basically, any pointers to get me going? Does anybody know of any good reads out there on upgrading?
Hmm, i'm not quite sure what my question is in this post... just general advice maybe.
I believe some functions are still there but are being depreciated? so i will want to remove using these. is there a list somewhere?
Thanks in advance.Well here is the change log for PHP5 from the official PHP Manual (<!-- m --><a class="postlink" href="http://www.php.net/ChangeLog-5.php">http://www.php.net/ChangeLog-5.php</a><!-- m -->)
Note that this is extensive and will take a little while to absorbe and also remember some things wriiten in PHP 5 wil not work at all with PHP 4 since it is not necessarily backwards compatible and some things that were problems in PHP 4 have been corrected, this is a new PHP altogether and OOP is much more supported than in the PHP 4 version so if you are comfortable with PHP 5 and how the OOP functions work with it they will not work (most of the new features of OOP) in PHP 4 so get used to a long transition from one to the other and plan on altering code in some OOP cases to do what you want to do.Jesus... thats one long list.
I know its significantly different but I think it will be ok, just something for me to get used to. Afterall, the language from what i can see is still basically the same.
I guess i'll start porting my project over, i'll just start at line 1 of the index.php and go forward like that
Get read for some problems! If you don't have problems you are not HUMAN...good luck. I use it in some cases but not so much yet since most webservers still use PHP4If you're positive that you're going to upgrade, you can minimize downtime by installing a server locally (or finding a production server) with PHP5. Copy your app over to this server and start tweaking it. That way you can just upload your PHP5-compatible source to the new host.
EDIT: Forgot to add... this is also probably the best way to prepare your script for PHP5. Just throw it on your testing server and set error_reporting to E_ALL and let PHP tell you where the problems are.Cool, thanks. I had meant to ask if i should do that, wasnt sure if it was a good idea or not.
Thanks againJesus... thats one long list.You should see the changelog for PHP 4 (<!-- m --><a class="postlink" href="http://www.php.net/ChangeLog-4.php">http://www.php.net/ChangeLog-4.php</a><!-- m -->). The only part of PHP5's changelog that is really relevant when upgrading from 4 are the bits right down the bottom for the 5.0.0 versions. And not even all of that (one change reads "Fixed bug #28999 (fixed behaviour of exec() to work as it did in 4.X).")
More relevant for your purposes would be the Migration (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/migration5.php">http://www.php.net/manual/en/migration5.php</a><!-- m -->) chapter.Cool, that might be a better read! thanks Well, I tried one of my projects and ... wow. it worked.
I'm actually quite amazed, there was only one error.
I istalled WAMP (with the PHP4 addon) so i could swap between the two easily and try stuff out.
Maybe this migration wont be as bad as i thought, but i need to go through and chech its all really working still What error_reporting setting are you checking all of this under? I personally think it'd be a good idea to set the level to E_ALL and fix even warnings/notices that might not bring the script to a screeching halt.I'm on E_ALL and i'm not getting anything :S the only error had was in a class i had defined a varaible twice by mistake
ie;
class something {
var $something = "hello";
var $something = "hello";
}Ok, ive found my first thing that doesnt *need* changing but i guess i should change it.
i'm ofcourse using mysql (normal) from PHP4.
so i see i can use mysqli just like i would have with mysql in php.
OR i can create it as an object.
Is the only reason for this to allow the programmer the flexability of doing it either way? and i assume there is no difference... right?
Also, how can i take a peak at the mysqli object code?so i see i can use mysqli just like i would have with mysql in php.MySQL isn't able to communicate with more recent versions of MySQL as effectively. The dbms-specific interfaces are being downgraded in prominence in favour of PDO.mysql object code?If you mean the object that represents the database connection, it's unlikely to be implemented in PHP; you'll be looking at the application source code to track that down. On the other hand there are some .NET-style reflection classes that allow some dissection of objects.The dbms-specific interfaces are being downgraded in prominence in favour of PDO.
Intersting, it looks good ive done allot of reading on it.
However... I cant get it working on the PHP5 server i have, i keep getting the error "could not find driver"
Do i need to install it? or are the drivers included? How can i check?
Thanksfixed it! had to update my php.ini