SimpleXMLElement触发“当前无法处理此请求”

We've recently upgraded to PHP 7, and I'm trying to get things working. We were using a rather random xml2array program which is no longer working, and I'd like to replace it with SimpleXMLElement rather than debug it.

  • PHP is generally working.
  • Errors are displaying.
  • Everything works as long as I don't run SimpleXMLElement or simplexml_load_file. As soon as I try and run these (using XML from PHP manual example), I get 500 error.

The key here was to find the error logs. This post has some useful notes on that: 500 Internal Server Error for php file not for html

...Once I found the error logs, they informed me that SimpleXMLElement had not been installed, and this caused PHP to crash rather than display an error message. So to find the error, I had to track down the error file.

This post explains that PHP will refuse to catch a fatal error: How do I catch a PHP Fatal Error