Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

how to get my first PHP script to run?

  • 04-07-2006 11:38pm
    #1
    Closed Accounts Posts: 397 ✭✭


    Hi,

    I'm new to web programming, and I'm trying to work my way through some PHP tutorials. I have created a file called hello.php with the following "hello world" set of commands ...

    <html>
    <head>
    <title>PHP Test - taken from tutorial ... http://uk.php.net/manual/en/tutorial.firstpage.php </title>
    </head>
    <body>
    <?php echo '<p>Hello World</p>'; ?>
    </body>
    </html>

    I then copied the file to my server space on webhost.ie, which supports PHP so I shouldn't have to do anything except open the file with my browser and it should display "Hello World"

    The problem is - it doesn't !! It displays the window with the correct text up at the top but it is not running the echo function - what am I doing wrong? have I named the file incorrectly or something?

    Incidentally when I look at the folder on the server the hello.php file is not displaying any icon that might suggest to me that the server recognises the file and knows how to deal with it.

    As ever, any help or direction would be appreciated.

    aoa


Comments

  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    get rid of the <p> </p> tags


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    The <p> tags shouldn't make a difference.

    Try removing the semicolon from the end of the echo statement (it's not required).

    Have you looked at the source to see what's actually coming out? If I had to guess, I'd say it's not interpreting the page at all, and interpreting the php statement as a complete tag, and so not showing it.


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    The code is fine, confirmed this on my local apache/php install.
    Sounds like you're doing everything else right... tbh I'd have a sniff around your hosting control panel, you might have to 'turn on' php if you've got windows hosting.
    Failing that, I'd say try again or contact the hosting support and see what's up.


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    The code is fine, confirmed this on my local apache/php install.
    Sounds like you're doing everything else right... tbh I'd have a sniff around your hosting control panel, you might have to 'turn on' php if you've got windows hosting.
    Failing that, I'd say try again or contact the hosting support and see what's up.

    I'll do what he says above. If you are on a windows hosting the php is not turned on by default.

    instead of <?php echo "Hello World" ?>

    write this <?php phpinfo(); ?>


  • Registered Users, Registered Users 2 Posts: 3,594 ✭✭✭forbairt


    is it not phpinfo(); ?

    Its not a case of you also having a .html file there as well thats getting run instead ? ...

    as has been mentioned check the source of the outputted page


  • Advertisement
  • Closed Accounts Posts: 397 ✭✭aoa321


    thank you all for the replies,

    I'll try it again tonight and let you know how I get on


  • Closed Accounts Posts: 70 ✭✭vito


    if you want to try it out on your own machine (and assuming its windows) try out wampserver.com/en for a great all in one wamp installer

    been using it for a couple of years now and its a hell of a lot easier than installing and configuring each app separately

    then you wont need to upload your script to a remote server everytime you make changes - just sits on your hard drive


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    The file is called hello.php?

    Is it the only file uploaded?

    I would have guessed its because you haven't named it index.php or something similar, most hosts look for a file named index as the first page to run, and if its not found I dont think it will run anything. However since you mentioned the text across the top displaying I guess thats not it... :confused:


  • Registered Users, Registered Users 2 Posts: 22,231 ✭✭✭✭Sparky


    Well I've copied the code above and tried it and it's ok

    Id say its your server.


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    Sparky-s wrote:
    Well I've copied the code above and tried it and it's ok

    Id say its your server.
    Welcome to 1:40 yesterday :D


  • Advertisement
  • Closed Accounts Posts: 27,857 ✭✭✭✭Dave!


    Welcome to 1:40 yesterday :D
    Let him have his moment ;):p


Advertisement