.
I'm not trying to convince you to like PHP. I'm just passing along some information. The bad security rap about PHP is due to bad application programmers, not big problems in PHP, per se.
Unlike C or C++, PHP is more than just a programming language. It's also an execution environment and it has a large set of built-in functions to make building dynamic web sites easier. It's the execution environment/functions side that has required some security fixes, much like in other execution environments such as Perl or Java. A C++ framework or class set can have similar security issues.
Why so many exploits with applications developed in PHP? PHP is very easy to approach for complete novice website "developers" that don't know what they're doing. Right or wrong, a few years ago PHP became a very widely offered "platform" by the web hosts. This combination produces a large number of exploits. It's an application "programmer" problem.
A competent programmer can write secure PHP applications. No cross-site scripting. No SQL injection. Etc.
BTW: I think you're right to stay away from off-the-shelf applications written in PHP without very careful vetting.
edit: clarifications