How to setup your first PHP page on cse.unl.edu

  1. Make sure you have read and setup the required directories and permission as described in FAQ section on Prerequisites for hosting a web page on cse.unl.edu.
  2. Change your working directory to the public_html directory.
     > cd ~/public_html
  3. Open a command line session to cse.unl.edu.
  4. Use an editor like vi or pico to create the index.php file. Refer to the FAQ pages on editors on cse.unl.edu. Pico being the simple Unix editor to use.
     > pico index.php 
  5. Use the editor to insert some HTML into the file, a simple HTML content is shown below.
        <html>
           <head>
               <title> This is my first page </title>
           </head>
           <body>
              <h1> My first page</h1>
              <?php  echo "<p>Hello World </p>" ?>
           </body>
        </html>
    
  6. Save the file and return to the command line.
  7. Grant everyone (others) read access to the file you just created.
     > chmod o+r index.html
  8. Open a browser and point it to: http://cse.unl.edu/~login/index.php and you should see the file you just created.
  9. If you get an error, tail the /var/log/apache2/error_log (the tail command shows any new lines added to a file) while you try to access your page to see if there are any errors. If you don't see errors in error_log, you should tail /var/log/apache2/suphp.log as well and then try to access your page again to see if any errors are reported.
     > tail -f /var/log/apache2/error_log 
  10. If you still can't get your PHP program working, see if the student resource center can be of any assistance or send an email to support@cse.unl.edu and someone will help you identify the problem.
Active: 
Yes
FAQ Priority: 
5.00
FAQ Category: 
Web Related