You have to write it directly into the various source files for the theme you're using - it won't process written directly in pages or html/text boxes as presented in the backend interface.
Look for files like header.php, footer.php in the theme folder.
Inserting php into posts and pages is done with conditional statements in the WP "loop".