Re: [PHP] error warning while connecting to posgreSQL

2008-09-30 Thread Adrian Videnie

Nilesh Govindrajan wrote:
Yeah that's true. Placing an @ before the function is a bad idea. Instead use 
error_reporting(E_NONE) OR error_reporting(0)
  


You should never use error_reporting(E_NONE), not even in production 
mode. The correct options are:


error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', false);
ini_set('log_errors', true);
ini_set('error_log', '/path/to/error.log');

While development, set display_errors to true and all errors should be 
output to screen. When moved to production, set display_errors to false, 
but continue to log any error/warning/notice into the error.log. You 
shouldn't get anything in there anyway, if your application is bug free 
(hehe, we wish). This way, you have a little bit of flexibility in 
debugging a problem that might appear.


Adrian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] error warning while connecting to posgreSQL

2008-09-29 Thread Richard Lynch
 -Original Message-
 i try to understand the error_reporting statement and to avoid all
 warning
 or error messages.
 for example i stop the postgresql service and i try to connect to it.
 when error_reporting is set to E_ALL, i get the following warning :
 *Warning*: pg_connect()
 [function.pg-connecthttps://192.168.1.2/se_admin/en/logon/function.pg-
 connect]:
 Unable to connect to PostgreSQL server: could not connect to server:
 Connection refused (0x274D/10061) Is the server running on host
 localhost and accepting TCP/IP connections on port 5432? in *
 L:\Webserver\se\log\checklogin.php* on line *48*
 Couldn't Connect:

 but if i have the error_reporting set to 0, i only get my die message
 Couldn't connect.

 i would like to know if i let the setting E_ALL do i have a way how
 to not
 display the warning message to end users but to display only Couldn't
 connect ?
 in fact to have the same behavior as error_reporting set to 0.

In production, you can suppress them with E_NONE.

Or, instead of displaying them to end users, log them and check the logs at 
your leisure.

It is technically possible to just slap an @ in front of the offending 
function, but that's a really bad idea.


___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error warning while connecting to posgreSQL

2008-09-29 Thread Nilesh Govindrajan
On Monday 29 September 2008 10:02:06 pm Richard Lynch wrote:
  -Original Message-
  i try to understand the error_reporting statement and to avoid all
  warning
  or error messages.
  for example i stop the postgresql service and i try to connect to it.
  when error_reporting is set to E_ALL, i get the following warning :
  *Warning*: pg_connect()
  [function.pg-connecthttps://192.168.1.2/se_admin/en/logon/function.pg-
  connect]:
  Unable to connect to PostgreSQL server: could not connect to server:
  Connection refused (0x274D/10061) Is the server running on host
  localhost and accepting TCP/IP connections on port 5432? in *
  L:\Webserver\se\log\checklogin.php* on line *48*
  Couldn't Connect:
 
  but if i have the error_reporting set to 0, i only get my die message
  Couldn't connect.
 
  i would like to know if i let the setting E_ALL do i have a way how
  to not
  display the warning message to end users but to display only Couldn't
  connect ?
  in fact to have the same behavior as error_reporting set to 0.

 In production, you can suppress them with E_NONE.

 Or, instead of displaying them to end users, log them and check the logs at
 your leisure.

 It is technically possible to just slap an @ in front of the offending
 function, but that's a really bad idea.


 ___

 The  information in this email or in any file attached
 hereto is intended only for the personal and confiden-
 tial  use  of  the individual or entity to which it is
 addressed and may contain information that is  propri-
 etary  and  confidential.  If you are not the intended
 recipient of this message you are hereby notified that
 any  review, dissemination, distribution or copying of
 this message is strictly prohibited.  This  communica-
 tion  is  for information purposes only and should not
 be regarded as an offer to sell or as  a  solicitation
 of an offer to buy any financial product. Email trans-
 mission cannot be guaranteed to be  secure  or  error-
 free. P6070214

Yeah that's true. Placing an @ before the function is a bad idea. Instead use 
error_reporting(E_NONE) OR error_reporting(0)


signature.asc
Description: This is a digitally signed message part.


Re: [PHP] error warning while connecting to posgreSQL

2008-09-28 Thread Ashley Sheridan
On Sun, 2008-09-28 at 11:00 +0200, Alain Roger wrote:
 Hi,
 
 i try to understand the error_reporting statement and to avoid all warning
 or error messages.
 for example i stop the postgresql service and i try to connect to it.
 when error_reporting is set to E_ALL, i get the following warning :
 *Warning*: pg_connect()
 [function.pg-connecthttps://192.168.1.2/se_admin/en/logon/function.pg-connect]:
 Unable to connect to PostgreSQL server: could not connect to server:
 Connection refused (0x274D/10061) Is the server running on host
 localhost and accepting TCP/IP connections on port 5432? in *
 L:\Webserver\se\log\checklogin.php* on line *48*
 Couldn't Connect:
 
 but if i have the error_reporting set to 0, i only get my die message
 Couldn't connect.
 
 i would like to know if i let the setting E_ALL do i have a way how to not
 display the warning message to end users but to display only Couldn't
 connect ?
 in fact to have the same behavior as error_reporting set to 0.
 thx.
 
I don't think you set error reporting to an actual number in the
php.ini. It should read something like

error_reporting = E_ALL  ~E_WARNING

if you want all errors but not the warnings.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error warning while connecting to posgreSQL

2008-09-28 Thread Alain Roger
i only set it via php code like error_reporting(0);


On Sun, Sep 28, 2008 at 11:11 AM, Ashley Sheridan
[EMAIL PROTECTED]wrote:

 On Sun, 2008-09-28 at 11:00 +0200, Alain Roger wrote:
  Hi,
 
  i try to understand the error_reporting statement and to avoid all
 warning
  or error messages.
  for example i stop the postgresql service and i try to connect to it.
  when error_reporting is set to E_ALL, i get the following warning :
  *Warning*: pg_connect()
  [function.pg-connect
 https://192.168.1.2/se_admin/en/logon/function.pg-connect]:
  Unable to connect to PostgreSQL server: could not connect to server:
  Connection refused (0x274D/10061) Is the server running on host
  localhost and accepting TCP/IP connections on port 5432? in *
  L:\Webserver\se\log\checklogin.php* on line *48*
  Couldn't Connect:
 
  but if i have the error_reporting set to 0, i only get my die message
  Couldn't connect.
 
  i would like to know if i let the setting E_ALL do i have a way how to
 not
  display the warning message to end users but to display only Couldn't
  connect ?
  in fact to have the same behavior as error_reporting set to 0.
  thx.
 
 I don't think you set error reporting to an actual number in the
 php.ini. It should read something like

 error_reporting = E_ALL  ~E_WARNING

 if you want all errors but not the warnings.


 Ash
 www.ashleysheridan.co.uk




-- 
Alain

Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008