When i migrating my website to localhost get some error in admin dashboard
Warning: fopen(C:/xampp/htdocs/ecompusell/storage/logs/error.log): failed to open stream: No such file or directory in C:\xampp\htdocs\ecompusell\system\library\log.php on line 6
Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\ecompusell\system\library\log.php on line 10
Fatal error: Call to a member function get() on null in C:\xampp\htdocs\ecompusell\admin\index.php on line 79
I tried which i see in google result but not working still in problem.If anyone know please tell me as soon as possible.
That is my log.php
<?php
class Log {
private $handle;
public function __construct($filename) {
$this->handle = fopen(DIR_LOGS . $filename, 'a');
}
public function write($message) {
fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "
");
}
public function __destruct() {
fclose($this->handle);
}}
I fixed my error by changing the code in log.php
file.
Below are the changes:
public function __construct($filename) {
$this->handle = fopen('C:/xampp/htdocs/' . $filename, 'a');
}
I just changed the DIR_LOGS path and the error was fixed.