简体   繁体   中英

Why won't Apache 2.1.7 in WAMP log PHP errors to the PHP error log?

I have WAMP installed and decided to use the default Apache 2.1.7 in the latest version of WAMP; the reason is my host server where my site is also uses 2.1.7. Previously, I was using Apache 2.2.11 in WAMP, because my last host also used that version.

The problem I have now is I seem to have some debugger on or something as when I get a PHP error it's shown like in the image below and the error is not logged to the PHP error log even though it's enabled, etc. in php.ini . When I switch back to an earlier Apache version, all errors are logged in the PHP error log.

So it must be Apache. Basically I want PHP to log errors to the PHP error log like it used to do. Why is this happening and how I can change it?

I don't mind the way the error is displayed as it helps anyway, because I can see it much better, but I still like it to log to the PHP error log as well.

Here's what a PHP error looks like since switching the Apache version in WAMP;

Here's the image:

在此输入图像描述

I managed to sort it. To re-enable PHP error logging again just do the following:

  1. Left click on the WAMP icon in task bar
  2. Then move mouse over PHP >
  3. Then go down and click on php.ini
  4. Now look for:

;error_log = "c:/wamp/logs/php_error.log"

(Note your location may be different on your computer and not the same as mine.) Now just remove the ; from the start of the line and save the php.ini and restart all WAMP services.

To make errors look like they normally do in PHP and to remove that orange box in the php.ini file look for:

zend_extension = "c:/wamp/bin/php/php5.3.5/zend_ext/php_xdebug-2.1.0-5.3-vc6.dll"

AND ADD a ; to the start of the line and restart WAMP. Now WAMP will be back to normal again.

It seems the new WAMP disables the PHP file error logging and instead logs PHP errors in the Apache error log. I am not sure if it did that previously, but either way, it solved my problem.

Check phpinfo(); output from the 'new' Apache, and compare it to what the old Apache outputs. PHP's settings can be overridden in 3 places: http.conf, .htaccess, and php.ini - and PHP can have multiple different php.ini's as well. phpinfo() is the authoritative source for what the current configuration is, because it's query PHP's internals for the info, at run time, so it will report the actual "live" settings.

If there's any differences in the settings (particularly the log-related ones), then you can start hunting down where the override is.

edit: now that your image is showing up, that's an informative warning, not an error. Means you're attempting to access an array element that doesn't exist, eg something like $_GET['this does not exist'] .

I followed the solution

  1. Left click on the WAMP icon in task bar
  2. Then move mouse over PHP >
  3. Then go down and click on php.ini. Now look for: ;error_log = "c:/wamp/logs/php_error.log;

Now just remove the ; .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM