I would like to make a system in which I would save some photos in the database and from the webcam I would take a photo at the time and compare it with the ones in the bank, I've searched the internet a lot but I just think I recognize the person's face, but not that way.
As already mentioned in the comments, PHP is not the ideal language to do face recognition itself.
However, as you are going to develop a web service, it is interesting to think of PHP as the web application that will receive the photos, after receiving them, you connect to a service or another language that will perform the recognition itself.
The task of recognizing faces from images itself is not trivial – you need an image database, develop a neural network, train it for there, then, if all goes well, gather a set of attributes common to each set of photos of the same person.
Of course this also depends a lot on your requirements: whether you need to find images identical to those currently existing (which I find difficult, as they will come from photos taken by webcams) or with a certain degree of similarity.