PHP error enhancements, cleaned up PHP warnings, misc fixes