Ever came across an error like these:

The solution is very simple.

In php.ini file, set

If sql.safe_mode is enabled, mysql_connect() and mysql_pconnect() ignore any arguments passed to them. Instead, PHP attempts to connect using the following details:

  • host: local host
  • user: the user PHP runs as
  • password: an empty string (“”)

So all the mysql connect functions will fail.