Enable errors in browser when parsing PHP-files

佐手、 提交于 2019-12-05 11:06:48

问题


I recently changed to a MacBook and now use the MAMP-stack for development locally.

In my earlier development environment I always could see informative error-reports when I tried to access a PHP file through a web-browser and an error occurred. With the default installation of MAMP it seems that this feature is disabled, whenever I hit an error I can't see the cause of it, I can't even see a single line informing me that an error occurred.

Not until I start to debug the code in a debugger I can see where the error occurred.

Any idea how error reporting can be turned on?

I tried:

error_reporting(E_ALL);

No effect at all though.


回答1:


reporting level to E_ALL and display errors on Include the following code at the top of every php file on in an include or require such as your config.php

error_reporting(E_ALL);
ini_set('display_errors', 'on');



回答2:


Try ini_set('display_errors', 'on');

You'll also want to check a phpinfo(), to see if the ini_sets are doing anything.




回答3:


Or change "display_errors = Off" to "display_errors = On" in /Applications/MAMP/bin/php/php5.4.4/conf/php.ini




回答4:


Navigate to MAMP settings (eg localhost:8889/MAMP)

Click PHP Tab

Find Log errors: setting

Tick to screen

Click Save



来源:https://stackoverflow.com/questions/6095798/enable-errors-in-browser-when-parsing-php-files

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