Why would one omit the close tag?

前端 未结 14 1587
旧巷少年郎
旧巷少年郎 2020-11-21 06:18

I keep reading it is poor practice to use the PHP close tag ?> at the end of the file. The header problem seems irrelevant in the following context (and this

14条回答
  •  旧巷少年郎
    2020-11-21 07:18

    In addition to everything that's been said already, I'm going to throw in another reason that was a huge pain for us to debug.

    Apache 2.4.6 with PHP 5.4 actually segmentation faults on our production machines when there's empty space behind the closing php tag. I just wasted hours until I finally narrowed down the bug with strace.

    Here is the error that Apache throws:

    [core:notice] [pid 7842] AH00052: child pid 10218 exit signal Segmentation fault (11)
    

提交回复
热议问题