Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #19183 > unrolled thread

[docker] error_log() not write inside web page

Started bySupaPlex <old@gamer.s>
First post2022-11-26 21:30 +0100
Last post2022-11-30 11:26 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  [docker] error_log() not write inside web page SupaPlex <old@gamer.s> - 2022-11-26 21:30 +0100
    Re: [docker] error_log() not write inside web page Arno Welzel <usenet@arnowelzel.de> - 2022-11-29 21:20 +0100
      Re: [docker] error_log() not write inside web page SupaPlex <old@gamer.s> - 2022-11-30 10:24 +0100
        Re: [docker] error_log() not write inside web page SupaPlex <old@gamer.s> - 2022-11-30 10:33 +0100
        Re: [docker] error_log() not write inside web page "J.O. Aho" <user@example.net> - 2022-11-30 11:26 +0100

#19183 — [docker] error_log() not write inside web page

FromSupaPlex <old@gamer.s>
Date2022-11-26 21:30 +0100
Subject[docker] error_log() not write inside web page
Message-ID<tltt21$1t5m$1@gioia.aioe.org>
supaplex$ cat docker-compose.yml
services:
     web:
         image: php:apache
         ports:
             - 8013:80
         volumes:
             - .:/var/www/html

supaplex$ cat index.php
<?php
echo "BEFORE\n";
error_log("abc");
echo "AFTER\n";

supaplex$ docker-compose up -d
supaplex_web_1 is up-to-date

$ docker-compose run web php index.php
Creating supaplex_web_run ... done
BEFORE
abc
AFTER

OK, but...

supaplex$ curl http://localhost:8013/
BEFORE
AFTER

Why *abc* does not appear?

[toc] | [next] | [standalone]


#19185

FromArno Welzel <usenet@arnowelzel.de>
Date2022-11-29 21:20 +0100
Message-ID<jun7rtFtd3rU4@mid.individual.net>
In reply to#19183
SupaPlex, 2022-11-26 21:30:

[...]
> <?php
> echo "BEFORE\n";
> error_log("abc");
> echo "AFTER\n";
[...]
> supaplex$ curl http://localhost:8013/
> BEFORE
> AFTER
> 
> Why *abc* does not appear?

Because error_log() does not produce any output:

<https://www.php.net/manual/en/function.error-log.php>

"error_log — Send an error message to the defined error handling routines"

And the error handling routines may not send the log message to the
output but only to the error log which is *not* send via HTTP to the client.

Next time please read the PHP manuals first, before asking here.

-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#19187

FromSupaPlex <old@gamer.s>
Date2022-11-30 10:24 +0100
Message-ID<tm77g8$1qkj$1@gioia.aioe.org>
In reply to#19185
Il 29/11/22 21:20, Arno Welzel ha scritto:
> Because error_log() does not produce any output:
> 
> <https://www.php.net/manual/en/function.error-log.php>
> 
> "error_log — Send an error message to the defined error handling routines"
> 
> And the error handling routines may not send the log message to the
> output but only to the error log which is *not* send via HTTP to the client.
> 
> Next time please read the PHP manuals first, before asking here.

Practically error_log() varies its behavior based on the API server 
(https://www.php.net/manual/en/function.php-sapi-php)?

[toc] | [prev] | [next] | [standalone]


#19188

FromSupaPlex <old@gamer.s>
Date2022-11-30 10:33 +0100
Message-ID<tm781p$2c7$1@gioia.aioe.org>
In reply to#19187
Il 30/11/22 10:24, SupaPlex ha scritto:
> Il 29/11/22 21:20, Arno Welzel ha scritto:
>> Because error_log() does not produce any output:
>>
>> <https://www.php.net/manual/en/function.error-log.php>
>>
>> "error_log — Send an error message to the defined error handling 
>> routines"
>>
>> And the error handling routines may not send the log message to the
>> output but only to the error log which is *not* send via HTTP to the 
>> client.
>>
>> Next time please read the PHP manuals first, before asking here.
> 
> Practically error_log() varies its behavior based on the API server 
> (https://www.php.net/manual/en/function.php-sapi-php)?

Sorry
https://www.php.net/manual/en/function.php-sapi-name.php

[toc] | [prev] | [next] | [standalone]


#19189

From"J.O. Aho" <user@example.net>
Date2022-11-30 11:26 +0100
Message-ID<juopemFr2ogU2@mid.individual.net>
In reply to#19187
On 30/11/2022 10.24, SupaPlex wrote:
> Il 29/11/22 21:20, Arno Welzel ha scritto:
>> Because error_log() does not produce any output:
>>
>> <https://www.php.net/manual/en/function.error-log.php>
>>
>> "error_log — Send an error message to the defined error handling 
>> routines"
>>
>> And the error handling routines may not send the log message to the
>> output but only to the error log which is *not* send via HTTP to the 
>> client.
>>
>> Next time please read the PHP manuals first, before asking here.
> 
> Practically error_log() varies its behavior based on the API server 
> (https://www.php.net/manual/en/function.php-sapi-name.php)?

I would say the API that the web server uses to talk with the PHP engine 
will not change the behavior, what you are looking for is

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during 
development, but
; it could be very dangerous in production environments. Depending on 
the code
; which is triggering the error, sensitive information could potentially 
leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
;
; Development Value: On
; Production Value: Off
; https://php.net/display-errors
display_errors = Off

-- 
  //Aho



[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web