When I am trying to log the error from my Mysql class its saying file not found
even though the path is correct
here is the path
protected function sql_query($query){
if (mysqli_query($this->conn,$query)){
$last_id = mysqli_insert_id($this->conn);
return $last_id;
}
else
error_log(mysqli_error($this->conn) . "\n", 3, "../var/tmp/sql_error.log");
}
So the folder looks like this
donations/api/dbHandeller.php
and the error log file is
donations/var/tmp/sql_error.log
ERROR
error_log(../var/tmp/sql_error.log): failed to open stream: No such file or directory in <b>C:\xampp\htdocs\donations\api\dbHandeler.php
Thanks
You're trying to write to a relative path. What you want to do is write to an absolute path, using getcwd()
.
error_log(mysqli_error($this->conn) . "\n", 3, getcwd() . "/var/tmp/sql_error.log");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.