Sql.safe mode

Ever came across an error like these:

Notice: SQL safe mode in effect - ignoring host/user/password information in [path]/adodb-mysql.inc.php on line 343 
mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in [path]/adodb-  mysql.inc.php on line 339

The solution is very simple.

In php.ini file, set

[SQL]
sql.safe_mode  = Off

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.