If they're all in one, or a few folders, it's not too hard. To make things easier go to Application/Applescript and double click Install Script Menu application. That will give you a Scripts Menu near the right of you menu bar.
Open the folder with all or some of the ".htm" docs. Go to the Scripts menu/Finder Scripts/Replace Text In Item Names. Click on File Names in the first window. Type "htm" (or whatever the file extension is) in the next Find window. Type "php" into the next Replace window. EVERYTHING in the front Finder window will now have the PHP extension.
Repeat with any other folders that you want to change. It only works on the front (active) window. Make sure that if you type the period (dot) into the Find letters that you also typre the period into the Replace letters.
There are a lot of other handy Applescripts under that Scripts folder, but you have to be careful not to screw things up with them.