A
A
Alexander Bagirov2015-02-02 20:09:25
PHP
Alexander Bagirov, 2015-02-02 20:09:25

How can I disable the display of the deprecated feature message?

Hello!
My PHP project uses a deprecated function that shows an error at the beginning of every page

Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/www/chess/mcc_common.php on line 2205

How can, without changing the code at the moment, disable the display of the warning?
Thank you!

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alexey Yakhnenko, 2015-02-02
@ayahnenko

SUDDENLY
don't use deprecated functions!

F
FanatPHP, 2015-02-02
@FanatPHP

Through the collective efforts of local hamsters (excluding the most stoned one), we managed to collect the correct answer:

  1. If the server is combat, then you need to disable the display of ALL errors in the browser. php_flag display_errors 0 in .htaccess or in php.ini or at least via ini_set.
  2. Specifically, this class of errors must be temporarily disabled altogether, using error_reporting(E_ALL & ~E_DEPRECATED);
  3. And, of course, over time, rewrite the code for working with the database on PDO prepared statements.

Z
ZmeY, 2015-02-12
@ZmeY

put a squiggle like this @ before calling your deprecated function
i.e. was mysql_pconnect...
became @mysql_pconnect...
no spaces between @ and mysql_pconnect

A
Azim Kurt, 2015-02-02
@Symphony

1. hide warning block with css
2. in server settings disable error notifications https://www.google.de/#q=apache+notice+off

I
IceJOKER, 2015-02-02
@IceJOKER

php_flag display_errors off
php_value error_reporting 0
php.net/manual/en/function.error-reporting.php
886ad2ed3d.jpg

K
KorsaR-ZN, 2015-02-02
@KorsaR-ZN

At the beginning of the main script, insert
This will also disable Notice, read more in the documentation
Or in the php.ini file, find the error_reporting
option there and write there - E_ALL & ~E_NOTICE & ~E_DEPRECATED , will require a restart of apache2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question