I am trying to print to a log. It will work at the very top of the page but not below a require statement.
This works...
<?php
$log_file = "../../../../errors.log";
$error_message = "test!
";
error_log($error_message, 3, $log_file);
require '../../../includes/functions.php'; // Utilities functions
However, this does not...
<?php
require '../../../includes/functions.php'; // Utilities functions
$log_file = "../../../../errors.log";
$error_message = "test!
";
error_log($error_message, 3, $log_file);
I have tried both require and require_once. Furthermore, I added the following code to the top of the page to override any mistakes that might have been made in the php.ini file:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require '../../../includes/functions.php'; // Utilities functions
$log_file = "../../../../errors.log";
$error_message = "test!
";
error_log($error_message, 3, $log_file);
I'm new to php and do not understand what is happening here. I also haven't found any similar reports online...
Any help would be very much appreciated.