Back to DFS's PHP Page


Your First Script

Your first script will generate the traditional "Hello, World!" greeting on the command line. Follow the simple steps below.

  1. Type

    cd
    to get to your home directory.

  2. Type

    mkdir PHP
    to create a new directory called PHP.

  3. Type

    cd PHP
    to descend into the newly created directory.

  4. Using vi, vim or some other editor, create a new file called hello_world.php.

  5. Type in the following lines:

    <?php
    echo "Hello, World!\n";
    ?>
     
  6. From the command line inside the PHP directory which you created, type

    php -f hello_world.php

Notes


© DFStermole: 2002
Created: 22 Sept 02
Last Modified: 22 Sept 02