Score:0

Is PHP's error_log dependent on the OS, config file or something else?

ro flag

I have two HTTP servers:

  1. Live LAMP server.
  2. Local WAMP server.

When an error occurs on the live server PHP will generate an error_log file in the directory of where the script error occurred. The local server does not do that.

Is the error_log dependent on the OS, PHP configuration or something else and how can I effectively verify the answer?

Score:1
in flag

It can be set to a value at compile time, and it can be set by configuration, so both is possible. Additionally, it can be modified at runtime, or by the webserver configuration. Create a simple php file just containing phpinfo() and call it with your browser. It will show you both the configuration and the runtime value.

<?php
phpinfo();

enter image description here

From this answer:

master is either the value compiled into PHP, or set via a main php.ini directive. I.e., the value that's in effect when PHP fires up, before it executes any of your code.

local is the value that's currently in effect at the moment you call phpinfo(). This local value is the end result of any overrides that have taken place via ini_set() calls, php_value directives in httpd.conf/.htaccess, etc.

It will also show you all ini files that have been loaded.

John avatar
ro flag
No value on the local server and a custom value on the live, okay. Working to verify...
John avatar
ro flag
I added `ini_set('error_log', 'error.log');` in a PHP file I'm testing, `error_log = 'error.log'` in the *only* php.ini file, restarted the Apache server and still not seeing anything after I use `echo $a;` which is not set. I have error reporting set to maximum sensitivity on the local server. Suggestions please?
John avatar
ro flag
This worked: `error_log = 'D:\wamp\logs\php_general.log'` in the `php.ini` file with `error_log('test');` in `test.php`; thank you.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.