I am using mysqli to handle Database operations and want to Log each and every error to a file sql-error.log
Code i am using is below:
$result = mysqli_query($this->_con,"CALL PROCEDURE_NAME(2)");
if(false===$result){
$error = 'Error calling stored procedure insert_product. Error No: ' .
mysqli_errno($this->_con) . ': ' . mysqli_error($this->_con);
error_log($error . "Date::" . date("l jS \of F, Y, h:i:s A") ."\n", 3, "/sql-errors.log");
exit();
}
And on cPanel, my Functions.php folder structure is as below:
/public_html/site_name/sql/functions/
But when i execute the query then i got a below Error
[15-Jan-2016 04:21:06 Etc/GMT] PHP Warning: error_log(/sql-errors.log): failed to open stream: Permission denied in /public_html/site_name/sql/functions/Functions.php on line ***
How to give permissions to write to this file and will error_log automatically creates file?
error_logis located755to777. Is it safe to do so??The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.0777has not worked and is still a problem