« Previous Next »

Thread: PHP default document (index.php) displaying code as plain text

Last post 06-08-2009 5:57 PM by brashquido. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 06-08-2009, 9:52 AM

    • soneill
    • Not Ranked
    • Joined on 06-08-2009, 1:29 PM
    • Posts 1

    PHP default document (index.php) displaying code as plain text

    Hi,

    I just setup PHP 5.2.9 on IIS 7 on Windows Server 2008 SP2. Most everything seems to be working fine -- PHP is running great, just about all PHP code runs perfectly... EXCEPT for default pages. Any default document (index.php) is not interpreted by PHP and the page merely displays the underlying PHP code.

    Best Example -- two pages (index.php + phpinfo.php) with the exact same code:
    <?php phpinfo(); ?>

    http://mysite.com/test/ --> "<?php phpinfo(); ?>" (displayed in plaintext)
    http://mysite.com/test/index.php --> "<?php phpinfo(); ?>" (displayed in plaintext)
    http://mysite.com/test/phpinfo.php --> Proper "blue/gray" PHP Info page

    What's strange is: the root of my site (http://mysite.com) interprets PHP just fine via its default document, index.php.

    I've set up the site via the "best practices" (iis.net/fastcgi/configuration). PHP is running via FastCGI. Index.php is the only default document type. "Mysite" is housed in a subdirectory off the root drive, and IUSR has permissions throughout. Handler Mappings shows PHP via FastCGI as the top entry for *.php.

    Been Googling this for hours, have seen others with very similar problems, but no resolution.

     
    Thanks,
    SEAN

  • 06-08-2009, 5:57 PM In reply to

    Re: PHP default document (index.php) displaying code as plain text

    Double check that you haven't got Windows Explorer set to hide extensions for known file types. It could be possible that your are seeing the index.php file that you created, which is actually index.php.txt because the true file extension is being hidden.
    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
Page 1 of 1 (2 items)
Microsoft Communities