Mamp/PHP:如何禁用有关过时功能的PHP警告消息 [英] Mamp/PHP: how to disable PHP warnings messages about deprecated functions
问题描述
在我的Web应用程序中,我的老板希望我使用msql_ * php函数,但由于有关这些不推荐使用的函数的PHP消息,我什至无法登录.如何在MAMP中禁用它们?在这个论坛上浏览,我发现以下规则可以在php.ini中编写
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"
但这是行不通的.我已将此代码写入MAMP中包含的每个php版本的所有文件php.ini.唯一有效的方法就是放上
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.
这里是我在/Applications/MAMP/bin/php/php5中的php 5.6.10的php.ini .6.10/conf/
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...
推荐答案
抱歉,我真的没有适合您的解决方案. 我确实是这样的:在我的.php文件中,我放了这段代码:
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);
似乎可行.
这篇关于Mamp/PHP:如何禁用有关过时功能的PHP警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!