cee oh em gee tee - "commgitt"
Login to access.
User: pw: ?


PHP: Hypertext Preprocessor, programming language, scripting language

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

A few examples

Hello, World!
(in html-format)
> Execute
(sep. win/tab)
print "<html><head><title>Hello, World! Script</title></head>\n";
print "<body>\n";
print "<p>Hello, World!</p>\n";
print "</body></html>\n";

Output from phpinfo(1).
A little bit more advanced
example showing some
> Execute
(sep. win/tab)

ob_start(); // start output buffer, => nothing's displayed until buffer's closed
phpinfo(1); // Show just general information (1)
$php_info .= ob_get_contents();
$php_info = str_replace("</body></html>", "", $php_info);
$offset   = strpos($php_info, "<table");
print substr($php_info, $offset);




Environment Variables

how to get client's IP address in PHP -

reserved variables -


Problems and Solutions

Until further notice, pls see Perl-section for more troubleshooting in general.

php-and-ssi.php - tests

Testing Scripts

Click to see how the web server handles different potential issues, details that may differ on different servers. All opens in a separate window (or tab).

Script Description
printhello.php Hello, World! program
phpinfo.php print lots of info about runtime environment

More extensive tests of scripts are also avaiable in the Perl-section, including one page runni ng a number of scripts (mostly Perl).

Macintosh Notes

PHP is by default NOT enabled; to enable uncomment one line in httpd.conf and restart server:

Default /etc/apache2/httpd.conf (== /private/etc/apache2/httpd.conf)

# 2008-02-27 Wed: removing preceeding '#' from line below 
LoadModule php5_module libexec/apache2/



Updated 2009-01-30