When you are upgrading php, you install the whole package from scratch, i.e new versions are not applied incrementally.
So, you do not need to go from 5.1 to 5.2 to 5.3, upgrade to the desired version directly (I recommend using php 5.4).
The php.net site is also very helpful when doing upgrades, you can see the new features and the changes which are breaking compatibility between versions.
Have a look at the following links:
http://www.php.net/manual/en/migration52.php
http://www.php.net/manual/en/migration53.php
http://www.php.net/manual/en/migration54.php
In my experience, code created for php 5.1 runs smoothly on 5.4.
The best approach would be to review the changes, setup the site on a development environment,do thorough testing, if everything is ok upgrade in production. Be sure to enable and monitor your server logs in production mode, so that you can catch problems, if any, as they arise.
1
solved PHP Upgrade from version 5.1.6 [closed]