Welcome Guest, Not a member yet? Register   Sign In
Send errors to stderr instead of stdout
#1

(This post was last modified: 08-14-2024, 09:50 PM by InsiteFX.)

Hi,


Is there a way to send PHP/CI4.5 generated errors to stderr instead of stdout ?

For eg, I have a crontab which sends an email only when it detects content on stderr : 

PHP Code:
*/10 * * * * root php myscript.php > /dev/null 


Here are some examples to illustrate the different scenarii:


PHP Code:
    public function test()
    {
        CLI::write("hello");
    

=> No mail sent => OK because written to stdout



    public function test()
PHP Code:
    {
        CLI::error("An error");
    }    
=> mail sent => OK because written to stderr

    public function test()
PHP Code:
    {
        $t 0;
    
=> no mail sent => Not ok because it generates a DivisionByZeroError to stdout instead of stderr

Thanks for your help,

Fred
Reply


Messages In This Thread
Send errors to stderr instead of stdout - by Fred9176 - 08-14-2024, 07:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB