When you say that the scripts using libpng are not executed properly, can you be more specific, or could you post such a script and the errors you get.
Meanwhile try to remove libpng and libpng-devel, and compile it from sources
. Take care to use a "--prefix=/usr" to put it under /usr/lib and after compiling and installing, run
to rebuild the libs cache. Then in the directory you've extracted php, run:
and then run the ./configure with the options you want. Mind that you can use just "--with-png" without the path to the library. In fact you can do this also for zlib and jpeg (there is no need to specify the library directory).