I noticed that you must set "$config['Database']['dbtype'] = 'mysql';" in your config.php. If you use mysqli then $db->query_read returns a mysqli resource and the script incorrectly tries to use it as a mysql resource, which results in "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" on line 116.
I received errors that the script was unable to set cookies because the headers were already sent. The problem might be because the script prints html before it includes global.php. A workaround was to open the forum front page once, so that the forum could set the cookies, and then get back to PEHI.
Otherwise the script worked nicely.