Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Enable the built-in PHP module' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Enable the built-in PHP module
Authored by: avanham on Nov 13, '03 12:55:34PM
Great hint! The test file needs brackets after the 'phpinfo' line though. Here is the correct version
<?php>
phpinfo();
?>


[ Reply to This | # ]
10.3: Enable the built-in PHP module
Authored by: warrens on Nov 14, '03 09:26:27PM
No, PHP doesn't need the ?> at the end of a script for it to parse correctly. May be nice for appearances (and necessary for brain-dead editors like Dreamweaver), but on the other hand, any empty lines you may have in your PHP after the closing tag, will be sent out to the client, which is unnecessary.
<? phpinfo();
works fine.

[ Reply to This | # ]
10.3: Enable the built-in PHP module
Authored by: babbage on Nov 17, '03 12:14:58AM

Just because it can be done doesn't mean it's correct.

The whole point of "smart" markup languages like PHP, SSI, ASP, or JSP is to contain the advanced logic inside of HTML/XML/SGML tags so that the document remains otherwise syntactically valid. If Dreamweaver complains about a dangling marker like PHP's "?>", it's doing the right thing.

Come on, its only another two characters (three if you count a line break) -- it's not hard to include, and doing so is one way to avoid a mentality of sloppiness that can come back to haunt you when debugging other code later.

---
--
DO NOT LEAVE IT IS NOT REAL

[ Reply to This | # ]

10.3: Enable the built-in PHP module
Authored by: avanham on Nov 17, '03 08:46:53AM

Actually, I was talking about the () brackets. The original post had only :

[code]phpinfo[/code]

which didn't work on my system until I added the brackets:

[code]phpinfo()[/code]



[ Reply to This | # ]
10.3: Enable the built-in PHP module
Authored by: babbage on Nov 17, '03 09:51:56AM

What? That doesn't work -- the 'greater than' character at the end of the first line breaks everything. Didn't you test this before commenting?

The version that actually works looks like this:

    <?php
        phpinfo();
    ?>

The version given earlier, which starts <?php>, just returns a blank web page for me. Drop the '>' from that line and it works. (The hint text is now using the broken version -- it probably should be amended.)

Also, I've tried two variations that give much different results:

    <!-- variation ONE:
         gives a roughly plain text page back -->
    <?php
     phpinfo;
    ?>

    <!-- variation TWO:
         gives a colorful, formatted page with tables, etc -->
    <?php phpinfo() ?>

I don't know enough PHP to speculate about what the difference is here, or why the result is so different. Is it because there are no line breaks in the second version? Is it because there is no 'end of line' character in that one? I can't figure out what the important difference is between the two tags, but they give very dissimilar output after being served.

---
--
DO NOT LEAVE IT IS NOT REAL

[ Reply to This | # ]