I think PHP is fine as long as you use a maintained framework, at least in my experience. I've used SlimPHP and Yii2 in the past and never had any security issues. I've worked on a few PHP sites that rolled their own frameworks which in retrospect was pretty iffy. One of them got yearly pen tests and there were never any issues found but the other two probably had some latent issues.