some error reporting questions

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
billygoatkaraoke
New php-forum User
New php-forum User
Posts: 91
Joined: Sat Aug 13, 2011 7:20 pm

Wed May 30, 2012 8:03 am

Gidday

I have a VPS running both my live site and a totally separate password protected version of the site as a production one. Both have exclusive databases and domains.

I was wondering if setting error reporting in php.ini is global (so it affects both sites)?

I'd like to set it up so that select errors are logged to a file above root in the live site, but all warnings and errors are displayed on the production site.

Is this possible, or is error reporting global?

If it is possible, can I have one error reporting config setting somewhere for each site, or do I have to have code on every php page instructing what I want?

Cheers guys

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Wed May 30, 2012 8:27 am

It is global. You can enable the error reporting on the selected site by using the "ini_set" command through.

Emy
New php-forum User
New php-forum User
Posts: 16
Joined: Sat Jun 02, 2012 8:16 pm

Sat Jun 02, 2012 8:48 pm

set display_errors to off in your pho.ini, then if you want to see the errors of each site juste add it on each page:

http://php.net/manual/en/function.error-reporting.php

billygoatkaraoke
New php-forum User
New php-forum User
Posts: 91
Joined: Sat Aug 13, 2011 7:20 pm

Mon Jun 04, 2012 2:44 am

Ahh - thanks guys. I like the idea of turning it off globally and then on per page when I need it.

billygoatkaraoke
New php-forum User
New php-forum User
Posts: 91
Joined: Sat Aug 13, 2011 7:20 pm

Wed Jun 13, 2012 7:01 pm

Just wanted to confirm that the error_reporting() functions only turn it on for the site the script is on, and not globally for the server (I'm assuming ini_set('error_reporting', E_ALL); would set it globally)?

Post Reply