My reply answers your question. If you compare your line and mine, you'll see two small differences between our lines. I'll even put them above and below eachother for you:
Mine:
echo "<a href=\"http://" . $SERVER['HTTP_HOST'] . dirname($SERVER['PHP_SELF']) . "file.php\">Link</a>";
Yours:
echo "<a href=\"http://[/b]" . $SERVER['HTTP_HOST'] . dirname($SERVER['PHP_SELF'] . [/b]"file.php\">Link</a>";
~Brett