Why no errors in my error.log

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Why no errors in my error.log

Postby kimmik » 08. January 2015 11:51

Please help me solve this mystery.
XAMMP on Windows 7. Installed on C: with all "Web" data on D: otherwise pretty normal.
Apache, MySQL and PHP running (as far as I can tell) without a problem
Virtual host defined thus:
Code: Select all
<VirtualHost *:80>
    ServerName myweb.localhost
    DocumentRoot "D:/WEB/myweb_info/htdocs"
    ServerAlias www.myweb.localhost www.myweb_info.localhost www.myweb_uk.localhost www.myweb_co_uk,localhost
    ErrorLog "D:/WEB/myweb_info/htdocs/logs/error.log"
    CustomLog "D:/WEB/myweb_info/htdocs/logs/access.log" common
    ServerAdmin admin@myweb.info
</VirtualHost>
#
<Directory D:/WEB/myweb_info/htdocs>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>


browsers (Firefox/IE/Safari) open web page myweb.localhost/index.php and display it correctly (heavy on php code and dynamic database)

All images and files correctly logged in the access.log (conclude that the above .conf is functioning correctly)

replace index.php with simple
Code: Select all
<?php
echo ("hello";
?>

The browser correctly displays:
Parse error: syntax error, unexpected ';' in D:\WEB\diabdata_info\htdocs\test1.php on line 2

However, the error.log (which does exist) remains stubbornly empty.

Is there some setting in the default install that is preventing all errors being written to the error.log file?

Oh, and just for the record I have checked in C:/XAMPP/apache/logs/error.log the above php error was not written there. The only entries in that error log are the same at apache startup each day (meaningless to me)
Code: Select all
[Thu Jan 08 09:49:21.284584 2015] [ssl:warn] [pid 1704:tid 516] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jan 08 09:49:24.030189 2015] [ssl:warn] [pid 1704:tid 516] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jan 08 09:49:29.802199 2015] [mpm_winnt:notice] [pid 1704:tid 516] AH00455: Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15 configured -- resuming normal operations
[Thu Jan 08 09:49:29.802199 2015] [mpm_winnt:notice] [pid 1704:tid 516] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Thu Jan 08 09:49:29.802199 2015] [core:notice] [pid 1704:tid 516] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/XAMPP/apache'
[Thu Jan 08 09:49:30.114200 2015] [mpm_winnt:notice] [pid 1704:tid 516] AH00418: Parent: Created child process 1960
[Thu Jan 08 09:49:32.142203 2015] [ssl:warn] [pid 1960:tid 412] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jan 08 09:49:32.766204 2015] [ssl:warn] [pid 1960:tid 412] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jan 08 09:49:33.015805 2015] [mpm_winnt:notice] [pid 1960:tid 412] AH00354: Child: Starting 150 worker threads.
kimmik
 
Posts: 21
Joined: 24. October 2014 12:08
Operating System: Windows 7 Home Premium

Re: Why no errors in my error.log

Postby Altrea » 08. January 2015 12:09

PHP errors are logged in the php_error_log file
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Why no errors in my error.log

Postby Nobbie » 08. January 2015 12:13

kimmik wrote:Is there some setting in the default install that is preventing all errors being written to the error.log file?


PHP errors are not logged by Apache anyway. PHP has its own error logging, simply edit php.ini, watch out for "error_log" and "log_errors" and also read all the comments about the error logging, everything is explained briefly in php.ini.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Why no errors in my error.log

Postby kimmik » 08. January 2015 12:20

Thanks, but now I am really confused. Not read yet and I WILL do so next.

But on the live server (host) all php errors are written to the correct (ie apache) virtual host file. I have not edited any setting in the php.ini on the live server. (The hosting company may well have done something to send errors to each of the virtual host error.logs.

Hopefully a read of php.ini on localhost will reveal all

I'll be back after reading through php.ini
(Important to note that there are many virtual hosts on localhost so redirecting php errors to their appropriate error.log files is not going to be simple is it?)
kimmik
 
Posts: 21
Joined: 24. October 2014 12:08
Operating System: Windows 7 Home Premium

Re: Why no errors in my error.log

Postby Altrea » 08. January 2015 13:28

You would need to change the error log path for each virtualhost, which is not possible for Apache-PHP Stacks where PHP is implemented as Apache module.

There are ways if PHP is implemented as (F)CGI-Module, like loading a very own php.ini for each vhost
http://stackoverflow.com/questions/2230 ... rtual-host

There are also ways to manipulate the php error_handler in your PHP application itself by for example defining an own error_handler, but this is not an efficient way for already existing applications because very common bigger changes have been done.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Why no errors in my error.log

Postby kimmik » 08. January 2015 15:33

Thanks.

One of my biggest concerns was that with previous installation of Apache + PHP (loaded separately) everything worked perfect. with php sending erros to the correct default error.log defined in each virtual host httpd-*.conf file. It broke in a big way when installing XAMPP.

having gone through the php.ini inside the XAMPP/php/ directory I have established that all the PHP flags that seem to matter have values that make sense, the one glaring exception is:
Code: Select all
error_log="C:\XAMPP\php\logs\php_error_log"

changing this to:
Code: Select all
error_log = "D:\WEB\myweb_info\htdocs\logs\error.log"

is a solution. BUT only for the virtual host myweb!!

TOTALLY unacceptable as there are may dozen virtual hosts!

We already have our own error_handler for determining the =E_ALL etc settings between development and live systems. But what we need is way to change the error_log setting so that the errors go to the correct file. For example detecting which virtual server is operating inside php.ini, changes to .htaccess or better still the httpd-*conf file to make the error.log work for php, or to instigate a php.ini file to override the default setting contained in each virtual directory (assumes that the global setting can be overriden by multiple virtual hosts running)

I have seen the latter option proposed bbut not that it works for multiple virtual hosts and nothing to suggest that a single parameter php.ini can have this effect.

Having seen
Code: Select all
<VirtualHost *:80>
    ...
    PHPINIDir /full/path/to/php/ini/
   ...
</VirtualHost>
might work for a complete and different copy of php.ini in each virtual host OMG what an administrative nightmare! what would be better would be a similar directive just for the error.log location.
kimmik
 
Posts: 21
Joined: 24. October 2014 12:08
Operating System: Windows 7 Home Premium

Re: Why no errors in my error.log

Postby kimmik » 08. January 2015 16:16

OK, I think I may have a solution.. not fully tested as yet but at least PHP errors for one vhost are going where they should.
Edit the hppd-*.conf as follows:
Code: Select all
<VirtualHost *:80>
   ...
   # enable PHP error logging
   php_flag log_errors on
   php_value error_log "D:/WEB/myweb_info/htdocs/logs/error.log"
</VirtualHost>

It appears to be important NOT to set the error_log or log_errors to anything in the php.ini (and of course restart Apache)
kimmik
 
Posts: 21
Joined: 24. October 2014 12:08
Operating System: Windows 7 Home Premium

Re: Why no errors in my error.log

Postby Nobbie » 08. January 2015 21:43

"Learning by Doing".... :)
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 281 guests