Php above DOCTYPE decleration effecting seo?


I recently completed a rather large website with forms on almost every page, each page containing approximately 80 or so lines of php programming.

After i submitted the website to the client he returned to me saying his SEO expert had told him that having php above the DOCTYPE will greatly effect his seo results… I had never heard of this before so i thought I’d consult some experts before i re-did the whole website.


None of the PHP will appear in the HTML that gets served unless it echos something to the page (and even then if it is in a function it will be echoed in the spot the function is called from).

As long as the generated HTML starts with the doctype any server side code in the source will make no difference whatsoever. The search engines only see the generated HTML just as real people do.

Sounds like the supposed “SEO Expert” has no idea of how server side processing on the web works.

PHP above the doctype tag (provided that the PHP doesn’t output anything before the doctype tag) will have less effect on SEO than the colour of your grandmother’s cousin’s dog’s fur will.

Note that if the PHP is outputting headers then that PHP MUST come before the doctype tag or it will not work at all.

Thanks for your reply,

Kinda thought this would be the case!