Changing a password requires passwd be run as either the user who is changing their password, or as root.
There is just not a good way to do this since anything executed in mod_php is run as the user nobody or httpd and has no rights (or shouldn't) on the system.
There are a few perl and c cgis that can do what you need over at
Hotscripts