Apache/2.0.50 (Win32) PHP/4.3.9RC2 Server at localhost Port 80
Nun möchte ich eine Halb-dynamische Seite erzeugen.
- Code: Select all
function makehtml($start_file, $ziel_file, $filename)
{
//
global $savekb_root_path;
$startfilename = $savekb_root_path . $start_file;
$tempfilename = $savekb_root_path . 'temp_' . $filename;
$targetfilename = $savekb_root_path . $ziel_file;
//Falls, die Zwischenspeicherdatei existiert, dann löschen
if( file_exists($tempfilename) )
{
@unlink($tempfilename);
}
$htmldata = file_get_contents($startfilename);
$tempfile = fopen($tempfilename, 'w');
if( !$tempfile )
{
echo "falsch2";
return false;
}
fwrite($tempfile, $htmldata);
fclose($tempfile);
copy($tempfilename, $targetfilename);
}
Wenn ich jetzt meine Datei shoutbox mit Apache aufrufe, dann gibt er mir einen komischen Source der php Datei zurück. Jedoch, wenn ich die selbe Datei hochlade und dort aufrufe, funktioniert alles normal.
Dieses Schnipsel schreibt die obrige Funktion in shoutbox.html:
- Code: Select all
db = $db; $this->template = $template; $this->config = $config; $this->show_shoutbox(); } function show_shoutbox() { // $this->template->set_filenames(array( 'shoutbox_body' => 'shoutbox_body.tpl' )); $sql = "SELECT * FROM shoutbox ORDER BY time DESC LIMIT 10"; if( !$result = $this->db->sql_query($sql) ) { error_message('Fehler bei der DB-Anfrage', true); } while( $row = $this->db->sql_fetchrow($result) ) { $this->template->assign_block_vars('shoutbox', array( 'NAME' => htmlentities($row['name']), 'TEXT' => htmlentities($row['text']), 'TIME' => date('d.m G:i', $row['time']) )); } $this->template->pparse('shoutbox_body'); } } ?>
Muss ich da was bei Apache oder php-Einstellungen umstellen? Wie schon vorher gesagt, auf dem Webspache funktioniert es einwandfrei.