Is it ok if I write to all professors that are offering Ph.D. positions the same email?
It is okay in the sense that it doesn't violate any ethical rules. However, I think it is unlikely that you will find success on this path.
Professors receive an unhealthy number of emails every day, and this increases with an unhealthy number of PhD application emails in PhD application season. If you want an email to a professor to be successful, it may pay off to carefully balance two counteracting forces: on the one hand, you want to be economical with the professor's time, and on the other hand, you want to stand out in a positive way. The most straightforward way to stand out is to be specific about the professor's research: why are you particularly interested in working with this person on this project, and where in this project do you see a first solution strategy that could potentially lead to a first paper?
It is a big ask to craft an email that satisfies these constraints. However, generic emails are very likely to be ignored. So that route is probably best avoided.