Re: GET, POST, REQUEST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 06/23/2006 09:46 AM John Nichel said the following:
>>> I come from languages
>>> where
>>> you not only have to initialize a variable but have to declare it as
>>> well so
>>> initializing comes natural, I feel wrong if I don't do it, even if the
>>> interpreter does not care.
>>
>> Just to be pedantic...
>>
>> The interpreter actually DOES care, but you have to be wise enough to
>> enable E_NOTICE messages for the interpreter to tell you that it does
>> care.
>>
>> You may want to get in the habit of using .htaccess to do that, as you
>> will be more comfy with PHP helping you catch any typos in failing to
>> initialize vars.
>>
>> :-)
> 
> I do that here....our development and staging servers have all errors
> turned on whereas on our production server, pretty much everything is
> turned off.  In a /perfect/ world, you would never see an error in my
> code, as I _try_ to write clean code, and trap all the errors before
> they get to the screen (no, not by the use of '@').  Since this is not a
> perfect world, and I don't always write clean code, it's nice to see
> those notices/errors pop up on the screen before the code gets live.  ;)

You should also leave all error flags on (except maybe for E_STRICT),
precisely because the world is not perfect. In the real world some bugs
may still escape when you ship the code to production. So you will want
to know of any notices caused by missed bugs, so you can fixed them
sooner rather than later.

What you should not do in production is to show error messages on the
page. I recommend the following php.ini settings:

http://www.phpclasses.org/browse/file/5051.html

What I do is to make PHP generate an error log and then can keep
monitoring it. If there are any log lines get added, the monitoring
script that is run regularly from cron, sends the added lines by urgent
mail to me so I can act promptly and fix any bugs before it is to late
to avoid major damage.

I use this class to watch PHP error log.

http://www.phpclasses.org/logwatcher

For sending really urgent mail, I use this class. It comes with a
wrapper function named urgent_mail(). It emulates the mail() function
but it attempts to inject the message directly in recipient SMTP server,
thus bypassing the local mail server, which is a good thing as the local
mail server may be too busy or not working at all (think of a disk full
or exhausted RAM).

http://www.phpclasses.org/mimemessage


I lost count of how many hours these small scripts save me of major
headaches and greater damages that could have been caused by often
subtil bugs.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux