Text only
University of Aberdeen Takes you to the main page for this section
php logo

PHP Hypertext Preprocessor

 

The best place to find out about PHP is the PHP web site (or the UK Mirror site). An HTML version of the PHP Manual is available on-site (and can be searched) and other formats are available elsewhere (9 Mbytes).

Notes:

  • all PHP scripts run with the privileges of the owner of each script. This allows most of the available add-on modules for PHP to be installed without compromising the security of users' files; it also allows the minimum access privileges to be set on any PHP files that contain login information (in Unix terms, this means read access only to the owner of the PHP file, group and world access being "none").
  • you can run your scripts using either PHP version 4 or version 5 by creating a file named "ht.access" (or ".htaccess") in the folder containing your scripts and then adding the line

    AddHandler x-httpd-php5 .php

    to the file. All scripts in the folder and its subfolders will then run using PHP version 5. Omitting the line will result in the scripts running under version 4; you might want to look at the differences between version 4 and 5;
  • a visit to this URL lists the add-on modules currently installed as well as giving some other useful information about PHP - the link is available only to users connected to the campus network. 
  • more details about these features are available from this Web page

Files (i.e. Web pages) containing embedded PHP statements should have the extension php.

Examples

  • The central header bar can be included in any PHP file via the (PHP) statement:

    virtual("/cgi-bin/include.cgi?section=my_section_name");

  • Here is an example of using PHP to allow authentication over the Web using your central systems userid and password; this time using a Microsoft Active Directory server as the authenticator. The source is available here.

  • Here is an example (and its trivial source) that will automatically redirect browsers from one page to another (in this case to /dit/).

  • Direct access to the Internet from web-based applications is not possible - your application must be written to use the central proxy service to connect to external web sites or services. Here is the source of one example of how to fetch RSS feeds from external sites while using the proxy.

Related topics

PHP includes functions to connect to various database packages. One of the most popular used in conjunction with PHP is MySQL. See www.abdn.ac.uk/local/mysql for more information.

It is also possible to connect to the central SQL Server cluster via PHP - please contact the Service Desk if you need to do this.


last modified: Wednesday, 16-Dec-2009 13:16:58 GMT


Valid XHTML 1.0 Transitional