Anyone have any idea why my index.php code is showing in my browser rather than the rendered HTML? I know this should be obvious to me, but I'm working on two hours sleep :(

Amy

Comments

neoliminal’s picture

My best guess is that you have an open <code> or <pre> tag somewhere and you need to close it.

anner’s picture

Are you sure you picked your php as your input type?
Can you post a sample? This might be it, depending: Junk {head} {styles} codes as output http://drupal.org/node/42080

techczech’s picture

Sounds like a server issue to me. Have you tried running another PHP file, such as phpinfo?

Gman’s picture

Yes, this is a server problem. Many base setups only look to render .htm or .html files. You need to tell them to all look for .php files and execute them as well. Otherwise they will just render them as txt files. -Gman

bransam’s picture

Is this my hosting's problem, or something I'm doing wrong?

criznach’s picture

Is it just index.php? Try putting a file like the one below in your web root and see if it renders...

echo "hello";

If it doesn't work, then it's probably a php/server issue. If it does work, check that the opening php tag in your index.php is ok. Also, check the opening php tag on any modules or theme files you've recently opened.

kashif mughal’s picture

May be you used php short syntax (<? ?>) instead of in your file.

if

    echo 'hello'; 

works fine, then this is server issue. Otherwise, it is php syntax issue. You can set "short_open_tag" on in your php.ini file.

kashif
www.kashifmughal.com

kjala’s picture

I had a similar problem with a drupal 7.14 installation submitted from outside vendor. Replacing the .htaccess file under /drupal folder with a vesion from fresh drupal installation solved the problem.