0

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?

1 Answer 1

1

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.

3
  • No value on the local server and a custom value on the live, okay. Working to verify...
    – John
    Nov 5, 2022 at 7:56
  • 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
    Nov 5, 2022 at 8:03
  • This worked: error_log = 'D:\wamp\logs\php_general.log' in the php.ini file with error_log('test'); in test.php; thank you.
    – John
    Nov 5, 2022 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.