Re: httpd(8) - PHP: More details in error log

2021-10-08 Thread Joe Barnett

On 2021-10-07 18:28, J. K. wrote:

Hi,

I have a question to OpenBSD's httpd and PHP.
Don't know if this is httpd related or PHP.

With the default settings it's hard to debug
error with my PHP script, because under
/var/www/logs/error.log there is no timestamp
or the requested URI. Is there a configuration
for httpd or PHP to get more details in the
error log?

Thanks in advance.

BTW: This is my second mail with the same
context on this list. But had some troubles
with my domain.

Kind regards,

J. K.


My apologies as I am not really answering your question, but here goes.  
My OpenBSD machine running httpd is solely for learning, and it is low 
volume. To simplify debugging, I log both access and errors to 
/var/www/logs/error.log with the following entries in /etc/httpd.conf


log access "error.log"
log error "error.log"
log style forwarded

The access information tells me about URI, timestamp, browser/agent, 
things of that nature.  Along with the errors that are logged in the 
same file, I then can easily associate a PHP error with a URI or 
timestamp.


My php and php-fpm files are unchanged from the defaults.  My guess is 
there are options that can be set in /etc/php-8.0.ini but I have not 
checked nor made any changes to that file. (I have php/fpm 8.0 installed 
on my OpenBSD 6.9 system; you might have different versions installed)


Anyway, this might be helpful for you in the short term -- until you are 
able to more correctly log the information you need.


--
Joe Barnett



Re: httpd(8) - PHP: More details in error log

2021-10-08 Thread Stuart Henderson
On 2021-10-08, J. K.  wrote:
>
> With the default settings it's hard to debug
> error with my PHP script, because under
> /var/www/logs/error.log there is no timestamp
> or the requested URI. Is there a configuration
> for httpd or PHP to get more details in the
> error log?

You can configure httpd to use syslog, which has timestamps. However
this affects access logs as well as error logs. Otherwise: code changes
are required.


-- 
Please keep replies on the mailing list.