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

PHP question

Options
  • 08-05-2006 11:47am
    #1
    Closed Accounts Posts: 69 ✭✭


    PHP why use it? if php is just code that can be embedded in html files why do we need to download php?


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    I suggest you read this first

    http://ie2.php.net/tut.php


  • Closed Accounts Posts: 69 ✭✭Layla1981


    but why do you need to download php?

    thanks


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Layla1981 wrote:
    but why do you need to download php?
    PHP is interpreted on the server. If the server does not have PHP installed it cannot do this. While many *nix machines now come with it as a standard option, it’s still not going to be on your machine if you’re running Windows.


  • Closed Accounts Posts: 169 ✭✭akari no ryu


    Layla1981 wrote:
    but why do you need to download php?

    thanks
    The only reason you'd need to download php is if you want to run a development server on your own machine.

    PHP is not code that can be embedded in html files. PHP can return data with a content-type of text/html but so can any language.

    PHP is a programming language designed to generate web content (images, xml, html). It is a parsed programming language. What happens when you go to a php page is the web server says to itself, "right, before handing them the data in this file, parse it with the php parser and then hand it over".


  • Closed Accounts Posts: 69 ✭✭Layla1981


    if i create a .php and having downloaded php do i need to tell IE that when i right click the .php and open in browser to interpret it??


  • Advertisement
  • Closed Accounts Posts: 69 ✭✭Layla1981


    you said php is not code that can be embedded in html but what about this

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


  • Banned (with Prison Access) Posts: 5,154 ✭✭✭Oriel


    Layla1981 wrote:
    but why do you need to download php?
    You don't. But if you want to the code you've written, then you do need to.


  • Closed Accounts Posts: 69 ✭✭Layla1981


    where exactly do i find your web server's root directory?

    Thanks

    Create a file named hello.php and put it in your web server's root directory (DOCUMENT_ROOT) with the following content:


  • Closed Accounts Posts: 169 ✭✭akari no ryu


    Layla1981 wrote:
    you said php is not code that can be embedded in html but what about this
    In debating terms, that's what we call a "argument by false comparison" fallacy.
    Just because you can do something in PHP doesn't mean that that's all that PHP can do.

    [PHP]
    <?php
    header ("Content-type: image/png");
    $im = @imagecreatetruecolor(50, 100)
    or die("Cannot Initialize new GD image stream");
    $text_color = imagecolorallocate($im, 233, 14, 91);
    imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
    imagepng($im);
    imagedestroy($im);
    ?>
    [/PHP]

    No html anywhere there.


  • Closed Accounts Posts: 169 ✭✭akari no ryu


    Layla1981 wrote:
    where exactly do i find your web server's root directory?

    Thanks

    Create a file named hello.php and put it in your web server's root directory (DOCUMENT_ROOT) with the following content:
    It's probably something like "C:\Program Files\Apache Group\Apache2\htdocs"
    or "/var/httpd/htdocs" if you're on *nix


  • Advertisement
  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    You do have apache or IIS installed on your machine though?

    If not, I recommend downloading http://apache2triad.net/

    It will set up everything you need to beging writing php


Advertisement