How can I get new lines in php error reporting messages?

Simple question, but can't find the answer.

When my PHP script generates multiple errors or warnings, etc. they all appear without any line breaks.  I have to figure out where each error message starts and stops.  How can I configure my php setup so that it places new line breaks after each error message so it is easier to decipher when it displays in my browser.

ALSO, I want to do this globally to the server, not just a particular script.

Thanks!
LVL 4
ariestavAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cornelia YoderArtistCommented:
What kind of errors or warnings are you getting?  Syntax errors usually die after the first one.  
0
ariestavAuthor Commented:
my error reporting is set to E_ALL.  So the warnings are annoyingly difficult to decipher.  
0
Ray PaseurCommented:
Please post a link to a web page that generates the kind of messages you describe, thanks.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Hugh McCurdyCommented:
Since you are interested in an answer for the server, I'm going to assume you control the server.  (Have admin access.)

The errors might be easier to read in the error_log file.  On my development computer, the file is in the folder /var/log/httpd
Look at the end of that file.  In Linux, I use the tail command to look at the last few lines.  My log file gives me the line # where the error occurred.  

On my system, the location of the error_log file is defined in /etc/httpd/httpd.conf


There are controls for how php behaves in the php.ini file.  On my development computer, php.ini is in a folder called /etc/httpd

In the meantime, I'm with Ray on this one.  It would really help to see the errors.
0
ariestavAuthor Commented:
The errors are "Notices" and "Warnings", they are not syntactical.  These errors output to the webpage for which the scripts builds after the request is done.  I don't want to look in an error_log file to find out what the error is--I already know what the error is.  I just want the format / display of the errors that appear in my output / echo's to be formatted better.

Thanks!
0
Hugh McCurdyCommented:
Would this work for you?

echo "Warning: phone number not specified<br />";
echo "Warning: zip code doesn't match state<br />";

Open in new window

0
ariestavAuthor Commented:
They would, but there is no way to add br's to errors output by the php parser.  I can't get ahold of the engine that outputs those.  If I could, I would manipulate each string that gets output from there.
0
Ray PaseurCommented:
Please see http://www.laprbass.com/RAY_temp_ariestav.php

This script will capture and change a Notice caused by the use of an undefined variable on line 8.  But even though this is technically possible, it seems like a better idea (to me, at least) to just fix the programming instead of trying to modify the error messages!
<?php // RAY_temp_ariestav.php
error_reporting(E_ALL);

// START THE OUTPUT BUFFER
ob_start();

// CAUSE A NOTICE
$x = $y;

// CAPTURE THE NOTICE
$notice = ob_get_clean();

// CHANGE THE CAPTURED NOTICE
$redact = str_replace(' in ', ' in <br/>', $notice);
$redact = str_replace(' on ', ' <br/>at ', $redact);

// SHOW THE WORK PRODUCT
echo "<br/>ORIGINAL NOTICE: <br/>$notice<br/>";
echo "<br/>REDACTED NOTICE: <br/>$redact<br/>";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ariestavAuthor Commented:
Thank you Ray.  This was good.  I hadn't thought of doing that.  I agree that fixing them is better.  But in some cases, I want to be able to decipher the messaging coming from PHP.  This will help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.