Hi,
I have the next php script and, this always work very well (loading time before 1 second) but about two or three days to now, I get the 500 Internal Server Error or this simple function spend more than 20 seconds to load.
My dreamhost server is “Burke”, I use mysqli to connect to the database.
In error.log I get: Premature end of script headers: menu.php…
Who can I put this working? Move to another webhost?
Please help me!!!
The php script is:
<?php header("Content-Type: text/xml"); ini_set('display_errors','On'); ini_set('display_startup_errors','On'); error_reporting(E_ALL & ~E_NOTICE); // db properties to mysqli class define ("DB_SERVER", 'mysql.domain.com'); define ("DB_NAME", 'db_name'); define ("DB_USER", 'db_user'); define ("DB_PASSWORD", 'db_pass'); include_once 'library/mysql.php'; // simple mysqli class function getRows ($sql){ $data = false; $myDB = new MySQL(); $myDB->Query($sql); if ($myDB->TotalRows() > 0) { while( $row = $myDB->FetchArray() ) { $data[] = $row; } } $myDB->Close(); return $data; } function mostraMenuXML($pid=0, $isMulti=false) { if ( $isMulti ) $menu = getRows("SELECT id, titulo FROM artigos WHERE menuid = $pid ORDER BY ordem, data"); else $menu = getRows("SELECT id, nome, publicado, tipo FROM menu WHERE parentid = $pid ORDER BY ordem"); if ( !$menu ) return ""; if ($pid==0 ) $xml = "\n\n"; else $xml = ""; if ( $isMulti ) { foreach ($menu as $item) { $xml .= "\n"; $xml .= "\n"; } } else { foreach ($menu as $item){ $xml .= "\n"; if ( $item['id'] != $pid ) $xml .= mostraMenuXML($item['id'], $isMulti); $xml .= "\n"; } } if ($pid==0 ) $xml .= "\n"; return $xml; } echo mostraMenuXML(); ?>