Why do PHP with MySQL is widely used and considered better than JDBC?

  1. PHP can easily be restricted using .ini so easy to setup server restrictions for hosting providers.
  2. PHP is server-side language and hence leak of username password for your mysql is very less possible (not impossible though). Connecting thorough JDBC requires these information to be incorporated into the calling app as javascript is a client side language. It may be beautifully hidden but more exposed to be stolen as compared to PHP.
  3. PHP connector to MySQL is a native driver as compared to JDBC.
  4. CMS softwares based on PHP are more popular and available as compared to thosed based on JS though nowadays there are several alternative methods available.