Packaged PHP installations can be removed fairly easily by removing the php5* packages. To be thorough, we'll target any packages that start
sudo apt-get remove '^php'
To uninstall something you installed from source, you would traditionally
cd back into the directory you built it from and run
sudo make uninstall but in this case it seems that PHP doesn't ship a removal target for
That makes removing it incredibly hard. You can either manually find all the files it installed, or you can (maybe) build a real package from the existing compiled version you have, install that over the existing files and then remove it.
sudo apt-get install checkinstall
Accept all the defaults. By the end of it, it should have built and installed a
php package (check the package name as
checkinstall tells you) and then you can remove it with:
sudo apt-get remove php # or whatever the actual package was called
checkinstall doesn't work (it doesn't always), you're left hunting for files. Stalking through the Makefile and commands like
locate php might help but with something as vast as PHP, it's going to be a long process. If you need a quick recovery, a reinstall (or backup restore, because you have those, right?) might be a better option.
As for verification, I'd just try running
php5 in a command line.
whereis php5 might be illuminating too. If they're returning results, you probably have more work to do.