LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   php not being parsed properly (https://www.linuxquestions.org/questions/linux-general-1/php-not-being-parsed-properly-542280/)

hiren_bhatt 04-01-2007 12:28 AM

php not being parsed properly
 
Well I have come across a strange problem in PHP. When I try to mix html and php the <? ?> tags are not being parsed.I exemplify this as following with output. I am using PHP 5.2.1, OS: XP and Firefox 2.0.0.3 and IE6. On my Linux system (FC3) I use PHP 4.3.9 and Firefox 1.5.9. there it works fine.

I doubt I have to change some option or parameter some where.

1. With <? ?> tags it does not work...
<?php
echo "Hello";
?>
<br />
<?
echo "How are your";
?>

Output: Hello
------------------------------------------
2. But With <?php ?> it works.

<?php
echo "Hello";
?>

<br />
<?php
echo "How are your";
?>

Output : Hello
How are you

hiren_bhatt 04-01-2007 01:09 AM

Problem solved.

SweetLou 04-01-2007 01:38 AM

Thanks for letting us know how you fixed it, so when others search they can easily find the answers.

For those that need to know, you need to change your .ini file to allow short tags.

hiren_bhatt 04-01-2007 02:20 AM

I should have mentioned how to do it. Thanks to bringing it to my notice.

in your php.ini file you need to allow short_open_tag,

i.e. short_open_tag = On

Note for developers:

One should try to avoid the use of short tags if things are to be redistributed. refer to php.ini for more information.


All times are GMT -5. The time now is 02:09 AM.