简体   繁体   中英

Why php fails to report syntax error and Apache crashes with segmentation fault?

I have a class file which has some buggy code eg

  else{
            $stp->Object($a);               
            $abbr = $a->abbr;
        }
        asdf
    } 

My understanding is that php should properly display an error message eg saying sth that "asdf" is not a class or constant etc . But as I see this peice of code crashes the server with segmentation fault , as my error log file says:

[Fri Mar 08 17:21:37 2013] [notice] child pid 8615 exit signal Segmentation fault (11)

Is it possible to configure php/apache to properly handle these errors ? Why php is failing to report the error some understandable way . I only see "The connection was reset" message in browser.

Specification: XAMPP (php 5.3.1) MAC OS 10.6 Xdebuger installed

Apparently something is going wrong into Apache, so it can't be properly displayed because the Apache child exit.

I had some similar error once because the PHP error made a redirection to a PHP error file (ex: ErrorDocument 500), which contained the same error, so it redirect to the PHP error page and so on... making a redirection loop.

Apache kill itself to avoid the machine to go down.


You have to diagnose what is making Apache die.

To do this, install "strace", eg. on debian :

apt-get install strace

Then stop your Apache, and start it through strace :

strace -f /usr/sbin/apache2ctl

Reproduce your problem until your Apache child crash, and try to look into the strace log to find out what happened.

Hope this helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM