Mamp/PHP: how to disable PHP warnings messages about deprecated functions

谁说胖子不能爱 提交于 2020-02-08 10:01:18

问题


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.



来源:https://stackoverflow.com/questions/31111088/mamp-php-how-to-disable-php-warnings-messages-about-deprecated-functions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!