473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can I make error msgs appear in the browser window?

Hi,
I've just started with PHP and am picking up my error msgs from the
Apache log file. Is there any way to force the error msgs to appear in
the browser window?

Thanks,
M. McDonnell

Dec 27 '05 #1
4 1774
Michael wrote:
Hi,
I've just started with PHP and am picking up my error msgs from the
Apache log file. Is there any way to force the error msgs to appear in
the browser window?
Yes,

During development it is much easier if you just let them appear during
scriptexecution.

You can do this in different ways.
If you have your own server, just edit php.ini, and look for ERROR_REPORTING
in it.
Read what it says before changing.
You probably want E_ALL

If you do not have access to php.ini, you can just start all your scripts
with with this directive by using ini_set().

Look it up here:
http://nl2.php.net/ini_set

Now find the name/value pair, and just set it.

The difference between php.ini and ini_set is that the former sets
directives for ALL PHP scripts on the server, and the latter just sets
something for the duration of your script.

Good luck

Regards,
Erwin Moller
Thanks,
M. McDonnell


Dec 27 '05 #2
Erwin,

Thank you for taking the time to respond with your clear and helpful
response. Used ini_set, and it works fine. Much better than looking at
the error log.

By the way, do you happen to know if there are any useful PHP
IDE/Debuggers out there? ... the type of environment where you can
single step, set breakpoints, inspect variables, etc.?

Thanks again,
M. McDonnell

Dec 27 '05 #3
Michael wrote:
Erwin,

Thank you for taking the time to respond with your clear and helpful
response. Used ini_set, and it works fine. Much better than looking at
the error log.
Good. :-)

By the way, do you happen to know if there are any useful PHP
IDE/Debuggers out there? ... the type of environment where you can
single step, set breakpoints, inspect variables, etc.?

Yes, just google for them.
I have no advise because I never needed them. As in Never.
And I make my living as PHP developer. :-)

Two things that are extremely helpfull when debugging/coding:
1) Errorreporting on (for all errors and notices and warnings)
That one you have up and running already. :-)
2) Just output your variables to the html.
An extremely usefull function for this is print_r($somevariable)
If you have arrays, no matter how complex, the follwing example will format
them for you:
from html:
<pre>
<? print_r($myComplexArray); ?>
</pre>

If you want to print an object, you can also use print_r().

Really, I never needed a debugger, and I know many others over here do not
use one.
I am not saying they are bad or anything, just that most developers don't
need one (for PHP that is).

Regards,
Erwin Moller
Thanks again,
M. McDonnell


Dec 28 '05 #4
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:43***********************@news.xs4all.nl...
Michael wrote:
Erwin,

Thank you for taking the time to respond with your clear and helpful
response. Used ini_set, and it works fine. Much better than looking at
the error log.


Good. :-)

By the way, do you happen to know if there are any useful PHP
IDE/Debuggers out there? ... the type of environment where you can
single step, set breakpoints, inspect variables, etc.?


Yes, just google for them.
I have no advise because I never needed them. As in Never.
And I make my living as PHP developer. :-)

Two things that are extremely helpfull when debugging/coding:
1) Errorreporting on (for all errors and notices and warnings)
That one you have up and running already. :-)
2) Just output your variables to the html.
An extremely usefull function for this is print_r($somevariable)
If you have arrays, no matter how complex, the follwing example will
format
them for you:
from html:
<pre>
<? print_r($myComplexArray); ?>
</pre>

If you want to print an object, you can also use print_r().

3) Use debug_print_backtrace();. It really helps if you're dealing with
included files, to show where the function or method call really originated.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
an*******************@gmail.com.NOSPAM.invalid
Dec 28 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: amith | last post by:
Hi, I have a javascript, calendar.js which i use to enable my client to select the date. This calendar pops up on the click of a gif image. But the problem is that this poped up window is not...
82
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | ...
1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
37
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
6
by: Richard Silverstein | last post by:
I'm a member of a forum sponsored by jasc.com ( http://forums.jasc.com/ ) which uses Webboard software. I use Firefox 1.0 (final release) as my browser. When I used previous versions of FF I had...
3
by: dricks dr | last post by:
Hi, I'm using the AxWebBrowser Control from microsoft in a C# application. It works fine, but i have many problems to hide the javascript error windows that appear when u visit a website with......
6
by: Robin | last post by:
Hello! I am useing ASP scripts with PERL and IIS 6.0 (Internet Information Server). The scripts are useing the 'Response.Redirect "xxx.asp"' cmd. Beside this there is a form which calls another...
4
by: Cylix | last post by:
Sample code of the problem: function inputOne() { alert('a'); } <input name="inputOne" id="inputOne" value="Warn" onclick="inputOne()"> The error is the object doesn't support this method.
1
by: Jim Davis | last post by:
I've been happily using a custom error handler of the following form for a while now: window.onerror = function(Message, URL, Line) { ... } The current case is an intranet application (support...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.