Friday, 20 October 2006

PHP links


The current version in CEMS is PHP5.

There are three servers with slighly different PHP configurations.
  • - a PHP script will run either on web02 for students or web03 for staff. PHP on these servers has error reporting turned off. For students, www is only accessible if a request has been approved to permit access.
  • - error reporting is turned on. You should use this server for all development. isa is only available within UWE
  • is an older server and runs PHP4
You can check the PHP configuration: isa, www, stocks

  • Put all php scripts in a suitable subdirectory of your public_html account on the UNIX server (in the nas folder)
  • To execute a php script, use a URL of the form
  • Use the 'isa' host for all development.
  • You need a line editor like PFE32 so that when an error references a line number, you can find that line in the editor. (we need a better editor - suggestions?)
  • Beware of the slight time lag between editing a script via Windows and the same changed script being executed on the relevant UNIX server.
  • Use the $_REQUEST array to access both get and post variables. Use method="get" when testing - it's much easier to detect errors if you can see the values being passed from the browser on the command line. You can also bookmark a URL so a test can be repreated without having to enter the data again. You will also need to use 'get' when a deep link is created, for example in the Album code to fetch a a JPEG.
  • You can get a php script to display nicely using a suffix of .phps. This can help spot missing quotes or brackets. In my examples I create a symbolic link in Unix to the .php file itself. Beware of exposing passwords to your MySQL account if you do this - place connection details in a separate file which can be placed above the web accessible pages in public_html.
  • Larry Ullman, PHP and MySQL for Dynamic Web Sites, Peachpit Press ISBN 0321336577
  • Luke Welling and Laura Thomson, PHP and MySQL Web Development, Sams Publishing. ISBN 0672326728
  • Leon Atkinson, Core PHP Programming, Prentice Hall , 2001

No comments: