I'm facing this error :

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/core/inc/config.php on line 7

I've tried to replace mysql with mysqli but I faced some errors.So I decided to return to mysql but my problem is how can I hide this error!?

3 Years
Discussion Span
Last Post by keloa

how can I hide this error!?

You really should use mysqli_* or else one day in the future when you upgrade PHP, your code will just stop working, and you'll have PHP complaining that mysql_connect() doesn't exist. When functions are deprecated, it is a sign that you must begin migrating to the alternatives. I highly recommend using mysqli_* as the syntax is pretty much the same as mysql_*.

If you still insist to use mysql_*, then you can tell PHP not to report the use of deprecated functions. Look through /etc/php/php.ini and search for error_reporting. Append & ~E_DEPRECATED to it. For example, my PHP config has:

error_reporting = E_ALL

so I'd end up with

error_reporting = E_ALL & ~E_DEPRECATED

Hope this helps

Edited by Assembly Guy


worked thanks, Ive tried but I faced some problems with mysqli :(

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.