Finally, after several trial and error, i managed to upgrade my PHP application to 5.2.0. I have been trying to upgrade to 5.1.x and it always failed in compilation step and the error message is always the same which is related to undefined reference to libiconv library.
So i changed some parameter and it worked. It can be compiled and next step is to install it by using make install. Next i tried to restart, but the Apache won't start because when i browse to my localhost, it won't displayed the page i was looking for. So i was thinking that the old php.ini was the main problem, so i had to rename the default php.ini in /etc into another name and then put the new php.ini on the correct place. But luck was not yet on my side as Apache still won't start, so i decided to look at Apache's configuration file, which is httpd.conf and finally i discovered why Apache won't start. It's because it still has two lines of code which still loads the old PHP4 modules, so i commented them out and tried to start it again and finally it worked.
Here's the screenshot: