You should not compare dajngo and rails with PHP as PHP is a language and django and rails are framework. Although there are many frameworks in PHP which you can compare with Rails and Django. There are a couple of reason why PHP is so popular:
1. PHP servers are easily available.
2. PHP frameworks are easy to setup and configure than the other ones.
3. PHP community is extremely strong.
4. PHP frameworks have got a lot of security features and very little footprint.
5. With PHP 7+ it got a lot of new features which are very useful.
7. Does not require a special application server.
8. Easy to migrate.
If you are interested in learning PHP you can take this end to end PHP Certification Course
Although PHP is quite popular, many giant corporations are now moving away from PHP simply because it's difficult to maintain a large code base written in PHP. They usually use other languages like Java, Python and more specifically farmeworks like Spring, Django, Rails are quite popular.