I’m running a simple CentOS 5.5 server with PHP 5.2.10. I’m trying to use PHP Simple HTML Dom parser but I get a 500 Server Error. Here is the script:
<?php
include_once('simple_html_dom.php');
$html = file_get_html('http://www.google.com/');
As you can see, I’m not even doing anything with the parser yet except trying to open a url. And that file_get_html is resulting in a 500 Server Error.
I don’t see any errors showing up in the httpd error log. So I’m not sure where to look to figure out the problem. The only PHP requirements for Simple HTML Dom parser seem to be PHP 5+ (check) and php allow_url_fopen = On (check).
Since version 5.2, PHP will generate HTTP 500 response if there is fatal error, and display_errors is off. Turn in on to see the error, that stops the execution of the script. Maybe file is not included (wrong permissions, path) and file_get_html() is not defined, or maybe file_get_html() produces a fatal error.