<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "<p>Hello World</p>"; ?>
</body>
</html>

Above code not working here:
http://melody.freeprohost.com/2.php


Likewise for the one below:

http://melody.freeprohost.com/1.php

<html>
<h3>The Date & Time: </h3>
<? echo (date ("l dS of F Y h:i:s A")); ?>
</html>

Above php codes working fine here:
http://melody.freeprohost.com/test1.php

But can't see the date and time below the words "The Date & Time" :
http://127.0.0.1/test1.php

I wonder where has gone wrong.
I would appreciate very much if someone could help me?
I have raised the same question in other php forum but no one seems to know where the problem lies. I typed the code on notepad and change the file extension from 1.txt to 1.php - could it be the reason for the problem?

    Just for the hell of it, try renaming the "2.php" file to "test2.php". (Just wondering if there's something funky in the server configuration where it's not sending files to the PHP parser if their name is just a number followed by the .php suffix. Seems silly, but you never know... :rolleyes: )

      Are you sure that the server have PHP installed?

        Can you try uploading file containing just the line below and try renaming it to phptest.php before you upload it:

        <? phpinfo(); ?>

          Something seems to be wrong with your servers configuration,

          if you click
          http://melody.freeprohost.com/phptest.php

          the link pulls up a blank page, now view source of the blank page and <? phpinfo(); ?> is in the source.

          Meaning the code is not going through the PHP parser

            I think I found where the problem is.
            If I save notepad as txt file and then changed to php later, it will not work.
            However, if I save direct as php, it works fine.
            Thanks to all for all your kind assistance.

              That is a really weird error that only that page works. Did you upload or edit test1.php differently from the others? What happens if you try using different opening and closing tags? ie:
              <?php phpinfo(); ?>
              <?PHP phpinfo(); ?>
              <? phpinfo(); ?>

                Wrong from me, tried to delete it but didn't find where to do that.

                  i guess you're not 'save as' it as .php... you only do renamed it... (hehehe)

                    Thanks to all of you for your time and kind response. Now my problem is resolved. I can get going with php. Hurray.
                    If I saved the notepad as ".php" straight instead of saving as ".txt" and then renaming it later as ".php", it works ok after uploading to my webhosting server.

                      Don't forget to mark this thread resolved (if it is).

                        Write a Reply...