apache displays an empty page when running php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaarthikeyapreyan
    New Member
    • Apr 2007
    • 106

    apache displays an empty page when running php

    my apache 2 server displays a blank page when i run this code
    [php]<html>
    <head>
    <title>PHP Test</title>
    </head>
    <body>
    <?php echo '<p>Hello World</p>'; ?>
    </body>
    </html>[/php]

    I have php5 and apache 2 in my machine
    But my HTML pages are running properly in my server and they display their contents.
    when i run my php code alone
    for example[php]
    <?php

    // Show all information, defaults to INFO_ALL
    phpinfo();

    // Show just the module information.
    // phpinfo(8) yields identical results.
    phpinfo(INFO_MO DULES);

    ?>[/php]
    This works great and all the information regarding php5 are displayed

    Is the problem because am combining HTML and PHP in the wrong way or do i have to set anything before i could do that

    Thanks
    Last edited by ronverdonk; Mar 19 '08, 10:15 AM. Reason: code within code tags!
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Originally posted by kaarthikeyaprey an
    <html>
    [PHP]<head>
    <title>PHP Test</title>
    </head>
    <body>
    <?php echo '<p>Hello World</p>'; ?>
    </body>
    </html>[/PHP]
    That should work. Personally I like to put brackets around like:
    [PHP]<?php echo( "<p>Hello World</p>" ); ?>[/PHP]
    But that won't make any difference.

    So there is no php response at all?

    Comment

    • satas
      New Member
      • Nov 2007
      • 82

      #3
      See Apache's logs for any errors.

      Comment

      • kaarthikeyapreyan
        New Member
        • Apr 2007
        • 106

        #4
        hey that a good catch :)
        The file did not have its permission
        But now I get the HelloWorld PHP's output but not the HTML stuff
        My expectation is why nothing from the HTML liners came out

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Please enclose your posted code in [code] tags (See How to Ask a Question).

          This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

          Please use [code] tags in future.

          MODERATOR

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            Originally posted by kaarthikeyaprey an
            hey that a good catch :)
            The file did not have its permission
            But now I get the HelloWorld PHP's output but not the HTML stuff
            My expectation is why nothing from the HTML liners came out
            There is no HTML output, except for the title of your page, because you don't output anything else but the title and the Hello World message. What else would you expect to see on your screen?

            Ronald

            Comment

            • kaarthikeyapreyan
              New Member
              • Apr 2007
              • 106

              #7
              Originally posted by ronverdonk
              There is no HTML output, except for the title of your page, because you don't output anything else but the title and the Hello World message. What else would you expect to see on your screen?

              Ronald
              Sorry about the code part,and I actually missed a line of HTML code everything is fine now

              Thanks

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                Glad it works now. See you next time.

                Ronald

                Comment

                Working...