Using PHP on

Here are some notes about writing and running PhP

  1. Your script must have a file suffix of .php
  2. Any sub-directory that you use within public_html must be “world executable”: chmod 755 php_files
  3. Also, your PHP script should be “world executable”: chmod 755 <filename.php>

Debugging and checking for errors:

You may include the following in your code for testing purposes:

ini_set('display_errors', true);
ini_set('display_startup_errors', true);

You should remove these lines of code once your program is up and running “in production”; these lines are only needed for testing.

In order to check for syntax errors, run the following from the Unix/Linux prompt (where “filename” refers to your file). If there are no errors, your file will be displayed as text on the screen:

php filename.php

General rules to remember about PHP:

  1. each line ends with a semi-colon
  2. be sure that the HTML/xHTML that you use is correct so that the PhP can generate it correctly for the browser
  3. concatenation symbol: use a period

Using PHP with HTML forms and passing the variables
to PHP:

(Use VIEW / SOURCE in browser to the code that PHP generates.)