Mamp/PHP: how to disable PHP warnings messages abo

2019-09-21 19:09发布

问题:

In my web app my boss wants me to use msql_* php functions but I can't even login because of PHP messages about these deprecated functions. How can I disable them in MAMP? Looking in this forum I've found the following rules to write inside php.ini

error_reporting  = E_ALL & ~E_DEPRECATED
display_errors = On
disable_functions = "list of mysqli_* functions"

but this doesn't work. I've written this to all file php.ini of each php version contained in MAMP. The only thing that works is to put

display_errors = Off

but I can't use it like that otherwisw I won't even be able to see my programming/syntax error of other problems.

Here is my php.ini of php 5.6.10 inside /Applications/MAMP/bin/php/php5.6.10/conf/

Do you have any ideas? I know I should use new functions and not deprecated ones but it's not up to me and I can't disable all error messages...

回答1:

I don't really have a solution for you, I'm sorry. I did like that : in my .php files I put this code :

 error_reporting(E_ALL ^ E_DEPRECATED); // without "~"
 ini_set("display_errors", 1);

It seems to work.



回答2:

Within the TEMATRES program (which is the program I use) there is a configuration file: config.tematres.php. This file has the following line:

Ini_set ('display_errors', 'On');
Error_reporting (E_ALL);

I changed it to:

Ini_set ('display_errors', 'On');
Error_reporting (E_ALL ^ E_DEPRECATED);

And thus I was able to solve the problem.



标签: php mamp ini