|
|
PHP- Anyway to "echo" to the console?
|
|
|
|
Registered User
Join Date: Apr 2003
Location: The Internets
Status:
Offline
|
|
I was wondering if anyone knew of a way or an extension that would allow some sort of debugging to the OSX console app.
like
<?php
echoMyConsole("this is text");
?>
But instead of echoing to the page the "this is text" code would go to OSX's console ouput?
thanks
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: May 2004
Status:
Offline
|
|
this will divert errors that normally go into httpd.log and puts them into a csv file.
Code:
<?php
// Write php errors to log file instead of apache log
error_reporting(0);
$old_error_handler = set_error_handler("userErrorHandler");
function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars){
$time=date("d M Y H:i:s");
// Get the error type from the error number
$errortype = array (1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024 => "User Notice");
$errlevel=$errortype[$errno];
//Write error to log file (CSV format)
$errfile=fopen("php_errors.csv","a");
fputs($errfile,"\"$time\",\"$filename:
line:$linenum\",\"($errlevel) $errmsg\"\n\n");
fclose($errfile);
if($errno!=2 && $errno!=8) {
//Terminate script if fatal errror
die("A fatal error has occured. Script execution has been aborted");
}
}
?>
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2003
Location: The Internets
Status:
Offline
|
|
thank you!.
so this will output the error to a text file? (little confused by the CVS label.)
awesome. i can then leave this file open in my text editor and it will auto update its contents.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2003
Location: The Internets
Status:
Offline
|
|
Originally posted by Chuckit:
Not CVS, CSV.
Doh! That's what i thought at first but then my current chest cold took over my thoughts..
Thanks all!
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status:
Offline
|
|
you can set the console to view other log files besides the main system log.
Go to:
Code:
File > Open Quickly > /var/log > httpd > ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|