Skip to main content
Inspiring
December 18, 2007
Question

Any way to enable "display_errors" (PHP) on a page-by-page basis?

  • December 18, 2007
  • 4 replies
  • 354 views
I have just discovered that my host sets 'display_errors' OFF by default. I
have asked them not to do this, but in the meantime, is there any way I can
enable this on the specific page?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


This topic has been closed for replies.

4 replies

Inspiring
December 18, 2007
.oO(danilocelic AdobeCommunityExpert)

>How about adjusting it this way: take code that David suggests, wrap it
>with an if statement that checks for you or a specified group of users
>being logged into the site, then you get the error reports, but no one
>that isn't authorized does.

The better idea on a live site is to write errors to a logfile. With
debug_backtrace() or your own error/exception handler it's even possible
to get a nice backtrace to where the error occured and which function
calls led to it.

Micha
Inspiring
December 18, 2007
Murray *ACE* wrote:
> Thanks, David.
>
> I'll have to adjust my thinking! 8(
>

How about adjusting it this way: take code that David suggests, wrap it with an if statement that checks for you or a specified group of users being logged into the site, then you get the error reports, but no one that isn't authorized does.

--
Danilo Celic
| Extending Knowledge Daily : http://CommunityMX.com/
| Adobe Community Expert
Inspiring
December 18, 2007
Thanks, David.

I'll have to adjust my thinking! 8(

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"David Powers" <david@example.com> wrote in message
news:fk8mov$283$2@forums.macromedia.com...
> Murray *ACE* wrote:
>> I have just discovered that my host sets 'display_errors' OFF by default.
>> I have asked them not to do this, but in the meantime, is there any way I
>> can enable this on the specific page?
>
> A live production site should never have display_errors turned on. It
> gives malicious attackers valuable information about your server
> structure.
>
> It's very easy to turn on the display of errors to debug a particular
> script. Just add this at the very top of the page:
>
> <?php ini_set('display_errors', '1'); ?>
>
> It must come before anything else.
>
> --
> David Powers, Adobe Community Expert
> Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/

Inspiring
December 18, 2007
Murray *ACE* wrote:
> I have just discovered that my host sets 'display_errors' OFF by
> default. I have asked them not to do this, but in the meantime, is
> there any way I can enable this on the specific page?

A live production site should never have display_errors turned on. It
gives malicious attackers valuable information about your server structure.

It's very easy to turn on the display of errors to debug a particular
script. Just add this at the very top of the page:

<?php ini_set('display_errors', '1'); ?>

It must come before anything else.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/