Let me first start by stating that I am by no means a webdeveloper, so please do point out if I'm going in the wrong somewhere in my story.
I think most people agree with the idea that using prepared statements effectively stops injections if executed properly. With that said, in order to write prepared statements in PHP, you need to establish a connection with the database in your php file. In other words, if the webserver ever becomes compromised, the account used to establish a connection with the database becomes compromised as well as its basically there inside a php file, allowing your attacker to basically create dumps out of your database. If I were to design an application, I would separate the website and the logic, through some API server or something similar, in order to make sure that the database account isn't compromised as well.
Why is it that nobody points out what in my eyes looks like an obvious security flaw in PHP? Or is the chance of this being exploited so small that people aren't even considering the chances that it might happen?
EDIT: Allow me to clarify a bit more about the subject. I don't think there's anything wrong with using prepared statements and people seem to have the wrong idea that I'm against it. My point is that if you use prepared statements on your webserver, it would also mean that a database account is stored on the webserver. Your webserver getting breached is a pretty bad problem, but I would like to think that it's even worse if a database account in plain text is leaked because of this breach. This is what I am referring as a security flaw, because wherever I check guides about PHP, nobody seems to mind the fact that you would have a database leak the moment your webserver is breached.
As I was saying, there's nothing wrong with using prepared statements, but I do think that there's a problem with using prepared statements in PHP specifically. Would it cause a problem for the webserver to proxy the request to another server that handles all the queries if you have a website written in PHP, for example?