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

Trying to learn PHP

  • 17-06-2007 5:18pm
    #1
    Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭


    I'm currently trying to learn PHP but can't even get the simplest of scripts working. I'm trying to echo "Hello World" but its not writing it.

    Heres my script (incl. HTML):

    [PHP]<html>
    <head>
    <title></title>

    </head>
    <body>


    <?php
    echo "Hello World";
    ?>

    </body>
    </html>[/PHP]

    At the moment the file extension is .html should it be .php? (it doesn't work as php either).

    Its possible that none of this code makes any sense if so can you tell me what I'm doing wrong (should it be in the head etc.).

    Thanks in advance.


Comments

  • Closed Accounts Posts: 146 ✭✭teckoda


    Looking at this post, I'm guessing why nobody has replied.

    Firstly, all your php code must be in a .php file. Second, php is a server side language which runs on a web server. A common one used is apache. If you wish to test your own php scripts on a local machine, i suggest you google for XAMPP, download the package, install it, put your scripts in the htdocs folder.
    Just remember, its possible to embed html in a php file, but not visa versa.

    Any further problems, there is plenty of documentation for all of the above available.


  • Closed Accounts Posts: 55 ✭✭Bluenarf


    as teckoda said, the extension needs to be .php, and then you need server side software that will complete all the things youve told it to do, and then convert it all to html and send it to the client.

    if you have a spare crap computer luyin around, may i reccmoned getting sme server.

    paul.
    www.paulsnet.org


  • Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭Seachmall


    Ok thanks. Another question,

    Does the server need to be online consitently? I'm guessing yes but I thought I'd check anyway.

    Thanks in advance,

    S.


  • Registered Users, Registered Users 2 Posts: 10,148 ✭✭✭✭Raskolnikov


    To save you the time and hassle of installing PHP on your own machine, you could just use the free online hosts that support PHP.

    http://www.atspace.com/


  • Registered Users, Registered Users 2 Posts: 32,136 ✭✭✭✭is_that_so


    You could also look at Xampp which combines a webserver and PHP.


  • Advertisement
  • Closed Accounts Posts: 146 ✭✭teckoda


    is_that_so, you have just repeated what i said. And Raskolnikov, installing xampp takes about 1 minute or less. geting some free space is alot more bother in the long term, you need an ftp client, you need to upload, download and edit etc..

    Well, If you want everyone to be able to view your servers content 24/7, its going to have to be online 24/7 . Depending on wether you open it to the public, which will require port forwarding on your router.

    What i do is, run a local webserver on my main pc for local testing. Once im happy with it, i upload it and publish it.


  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    Searchmail, a great site to start off with is this one!

    Best of luck!

    McGintyMcGoo


  • Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭Seachmall


    I never thought of W3schools, thanks.

    Basically, I'm looking to set up an order form (no credit, debit details will need to be passed so no need for super high security) using PHP and MySQL. The admin will be able to view the orders by accessing an Admin page of the site and viewing the orders there. Does the server need to be always online?

    Also if you purchase a new server do you need to install programs or will they be ready installed?

    Thanks and sorry for all the questions. I've been googling but can't find what I'm looking for, just setting up home servers to download files while away from home.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Does the server need to be always online?
    That appears to be the second time that you've asked that, and it has me worried as to how you reckon this will work.

    If a web server is offline, no-one will be able to visit your pages. If the web server is running PHP and MySQL, there will normally be no difference between the web server being online and the PHP/database being online.

    So, if you put both on the hosting server (presuming it supports PHP and MySQL) then you're sorted.

    If, on the other hand, you are getting a bog-standard HTML website to submit to a separate PHP/MySQL server, then yes, the PHP/MySQL server will need to be online at whatever moment the form is submitted.

    And since you can't predict when this might happen, that means all the time.

    To be honest, though, with PHP and MySQL almost standard on budget hosting packages for less than a tenner a month, I'd put them all on the one.

    Just make sure that the Admin page is reasonably secure (not necessarily SSL but at the very least passwords, etc); credit card details are the most important info to be kept (and SSL is a must) but Data Protection guidelines will need to be followed if there are any email or other contact details kept in the database.


  • Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭Seachmall


    I'd put them all on the one

    What do you mean by this?

    I'm going to have to do alot more research into this obviously.

    Thanks.


  • Advertisement
Advertisement