What is the cause of eye pain?

There are many causes that can cause eye pain. Inflammatory ones, such as keratitis, ocular fasciitis, sclerositis, anterior uveitis, endophthalmitis, etc.; those caused by increased eye pressure, such as ciliary ring block glaucoma, acute angle-closure glaucoma, neovascular glaucoma, etc.; those caused by trauma, such as iris-ciliary contusion, corneal contusion, eye rupture, etc., as well as refractive error, excessive eye use, etc. can all lead to symptoms of eye pain.
It is advisable to see an ophthalmologist for an examination so that a clear diagnosis can be made, and also to note any other symptoms yourself so that you can inform the doctor along with them at the time of your visit.