PHP's biggest strength is ease of deployment and popularity. Deploying a nodejs app is a nightmare, because of the fact that nodejs isn't a web-first language in the traditional sense. It's a general purpose language that can do many things, but that causes problems for, i.e. hosting multiple apps on a single server (without having to coordinate ports between them, firewall them off, and have a single nginx instance proxying to them based on domain names).
PHP is simple to deploy. If you have a shared hosting, just upload files to the FTP server, and open the page in the browser. It works. If you have a root server, just `sudo apt install -y apache2 libapache2-mod-php7.3` and put the files in /var/www/html/
It's a perfect fit for web because that's the only place where it actually works. It does one thing (platform) and it does it well (from the deployment perspective).
It has (had) it's warts in the years, but I don't find many things that it doesn't have compared to other scripting languages.