Skip to content

Instantly share code, notes, and snippets.

@msanjaypandit
Last active March 7, 2018 09:23
Show Gist options
  • Save msanjaypandit/ac3136c41a01cb8a77066a044f64b1ef to your computer and use it in GitHub Desktop.
Save msanjaypandit/ac3136c41a01cb8a77066a044f64b1ef to your computer and use it in GitHub Desktop.
[PHP Codes] #php #php-log-file #errors #php-file-write

Generate PHP Error on a Specific IP Generate PHP Errors on a Specific IP

if($_SERVER["REMOTE_ADDR"] =='xxx.xxxx.xxx.xxx'){
  error_reporting(E_ALL);
	ini_set('display_errors','Off');
	ini_set("log_errors", 1);
	ini_set("error_log", "Your Error log path");
  # Your Error log path e.g "D:/xampp/htdocs/live/errors/lservererror.html"
}

Write a PHP File Write PHP Errors in a single file

##Generate file##
$arrayInfo =array();
$path = "/var/www/html/";
$fp = fopen($path."arrayDetails.txt", "a");
fwrite($fp, print_r($arrayInfo,true));
fclose($fp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment