/    Sign up×
Community /Pin to ProfileBookmark

PHP on IIS using <? ?>

I am trying to script a page on my IIS server running PHP, and every time i try to use the <? ?> in the script, it wont load it.

[code]
Normal Page with NO error

<?php
echo”this is what is working fine but when i close and reopen the php it causes a error”;

?>
———————————-
Page With Error

<?php
echo”this is what is working fine but when i close and reopen the php it causes a error”;
?>
<head>
</head>
<body>
<center>this is where it causes the error<br> because i shut the php down using the “?>”</center>
</body>
<?
echo”Now the page wont load couse i used the ?> <?”;
?>[/CODE]

Any help on this ASAP would be greatly appricated

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@tracknutOct 07.2010 — I don't think it has anything to do with "reopening php" for a second time. Your server needs to be configured to use the "<?" syntax instead of "<?php" - have you tried just using "<?php" everywhere?

Dave
Copy linkTweet thisAlerts:
@ldravenzauthorOct 07.2010 — yes i have, and it just comes up blank
Copy linkTweet thisAlerts:
@tracknutOct 07.2010 — Is the above example (the one that doesn't work) exactly what you're testing with? For example the last echo is outside </body>, which probably isn't where you want it, and contains the text "?>" within the quotes of the echo statement, which could be quite exciting for php to parse, etc, etc.

Otherwise, I don't see it, though I've never used IIS.

Dave
Copy linkTweet thisAlerts:
@OctoberWindOct 08.2010 — I would check your phpinfo() for [b]short_open_tags[/b]. Sounds like that might be dissabled (as i should).

I think starting with some version of PHP4, it is disabled by default. With short_open_tags turned off, you need to use the full <?php ?> tag set, not the shorthand <? ?> or <?= ?>. It's a safer, more portable method, even if it is an extra 3-7 characters.
×

Success!

Help @ldravenz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...