2

I've got a web server running IIS7 and I just updated to PHP 5.3. I have two sites that seem to run fine, and they both use some small degree of PHP. The revision I am currently testing on this server, presumably uses much... much more.

The problem I am encountering is that on my testing server ( a local XAMPP installation ), my page loads fine. When I push this to my server and hit the page in my browser, I get the following:

Id ) return true; } return false; } public static function PrintSelector($SelectionArray) { if( !isset($SelectionArray)) { Page::WriteLine("
No selections are available.

"); } else { $FoundViewer = false; foreach($SelectionArray as $Selection) { if( $Selection->IsViewing()) { $ViewerSelection = $Selection; $FoundViewer = true; } } if( $FoundViewer ) { Page::WriteLine("Show / Hide " . get_class($Selection) . " Selections"); $ViewerSelection->PrintOverview(); Page::WriteLine("
"); } Page::WriteLine("\n"); foreach($SelectionArray as $Selection) if( $Selection->IsSelectable() && !$Selection->IsViewing()) $Selection->PrintSelection(); Page::WriteLine("
\n"); if( $FoundViewer ) Page::WriteLine("
"); } } } ?>

Which is just a bit of the underlying code for my new site.

Upon further investigation, I run down to one of my other sites and get this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>AGP Credential Manager</title>

<link rel="stylesheet" href="styles.css" type="text/css" />

<script type="text/javascript">

function submitPageForm()

{

  document.forms["pageForm"].submit();

}



function submitForm(formName)

{

  document.forms[formName].submit();

}

</script>



<script language="javascript">

  function toggleDiv(divid){

    if(document.getElementById(divid).style.display == 'none'){

      document.getElementById(divid).style.display = 'block';

    }else{

      document.getElementById(divid).style.display = 'none';

    }

  }

</script></head>

<body>

<div id="wrap">

    <div class="header">

        <!-- TITLE -->

        <h1><a href="#">AGP Credential Manager</a></h1>

        <!-- END TITLE -->

    </div>

    <div id="nav">

        <ul>    

            <!-- MENU -->

In the source code. And as I'm sure you can presume, not much for my front-end. It seems as if the PHP starts executing, but fails some couple hundred lines in... for no apparent reason.

Curious if anyone has seen this before and happens to know the fix? Would be great. Thanks.

6
  • Correction: The first code segment is actually encapsulated in some php that just gets caught by chrome as html tags. The full segment of code that I got back from my index page, is actually the entirety of a page that I require_once at some point. Un-parsed by the PHP interpreter. Commented Apr 10, 2012 at 22:09
  • 1
    Is the unparsed PHP code opened using <? as opposed to <?php? This would mean short_open_tag is turned off in php.ini. Commented Apr 10, 2012 at 22:19
  • 1
    HAH! That is accurate sir. I'll give that a spin. Commented Apr 10, 2012 at 22:22
  • Nailed it. You should repost as an answer so you get credit ;) Commented Apr 10, 2012 at 22:24
  • Here's a question - anyone have a regular expression to find <?\r\n ? Seems like <? gets parsed as something else. I dont really do regular expressions. Commented Apr 10, 2012 at 22:26

2 Answers 2

2

IIS and Apache are two different beasts. For you own sanity, strive to keep your development environment close to your deployment environment.

Sign up to request clarification or add additional context in comments.

1 Comment

Sound advice, and thanks... But I'm not sure that it quite resolves my problem. :P
1

I suspect the issue may be that your PHP script uses short tags <? but the PHP configuration is such that it does not accept short tags and wants full tags <?php.

You can either change php.ini and set short_open_tag to 1 or modify the scripts to use the full open tag. I would recommend using the full open tag as the short tags have problems with XML files with PHP extensions.

You will also want to check for short echo's, <?= and replace those with <?php echo.

Some regex you may try:

/<?([^p])/<?php$1/g
/<?= /<?php echo /g

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.