Login to access.
User: pw: ?

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 tests

  Method Result Comments
PHP Version phpversion() 5.5.34  
short_open_tag ini_get('short_open_tag') 1 Prefer Not Set - easier and clearer handling of mixed PHP (<?php) and XML (<?xml).
  Safe technique short_open_tag
Code: <?php echo "$test";?> <?=$test?>
Output: Yes! Yes!

"Since PHP 5.4.0, <?= is always available." [src]


Version in use (5.5.34) is newer than 5.4
Timezone get_cfg_var('date.timezone')

(Not set)



Error Handling

$my_error_reporting_enable = 1 (in script)

<?php echo $some_undefined_variable;?>

Notice: Undefined variable: some_undefined_variable in /homepages/41/d105562370/htdocs/comgt-com/lib/php/index.php on line 216
Missing file,
<?php include "some-non-existing-file.php"; ?>

Warning: include(some-non-existing-file.php): failed to open stream: No such file or directory in /homepages/41/d105562370/htdocs/comgt-com/lib/php/index.php on line 220

Warning: include(): Failed opening 'some-non-existing-file.php' for inclusion (include_path='.:/usr/lib/php5.5') in /homepages/41/d105562370/htdocs/comgt-com/lib/php/index.php on line 220

From / manual / en / errorfunc.configuration.php (R:2016-02-29):

Errors and Logging Configuration Options
Name Default Changeable Changelog This System
error_reporting NULL PHP_INI_ALL   22517
display_errors "1" PHP_INI_ALL   (Not set)
display_startup_errors "0" PHP_INI_ALL   (Not set)
log_errors "0" PHP_INI_ALL   (Not set)
log_errors_max_len "1024" PHP_INI_ALL Available since PHP 4.3.0. (Not set)
ignore_repeated_errors "0" PHP_INI_ALL Available since PHP 4.3.0. (Not set)
ignore_repeated_source "0" PHP_INI_ALL Available since PHP 4.3.0. (Not set)
report_memleaks "1" PHP_INI_ALL Available since PHP 4.3.0. (Not set)
track_errors "0" PHP_INI_ALL   (Not set)
html_errors "1" PHP_INI_ALL PHP_INI_SYSTEM in PHP <= 4.2.3. (Not set)
xmlrpc_errors "0" PHP_INI_SYSTEM Available since PHP 4.1.0. (Not set)
xmlrpc_error_number "0" PHP_INI_ALL Available since PHP 4.1.0. (Not set)
docref_root "" PHP_INI_ALL Available since PHP 4.3.0. (Not set)
docref_ext "" PHP_INI_ALL Available since PHP 4.3.2. (Not set)
error_prepend_string NULL PHP_INI_ALL   (Not set)
error_append_string NULL PHP_INI_ALL   (Not set)
error_log NULL PHP_INI_ALL   (Not set)
Additional, by COMGT:        
zend_extension = "" (php.ini)   (Enhanced error handling) (Not set)

Some research


Environment Variables

how to get client's IP address in PHP -

reserved variables -


mail - send mail (send emails)

(PHP 4, PHP 5) mail — Send mail, man page:


( )


Problems and Solutions

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

php-and-ssi.php - tests


Shell Scripts in PHP

If want to create scripts for use both in web server but also maybe occasionally as scripts.

!/usr/bin/env php

print "<html><head><title>Printenv Script</title></head>\n";
print "<body>\n";
print "Hello, World, in PHP";
print "</body></html>\n";

Important details:

1) Shebang as first line
2) (Apparently) Also must have '<?php' .. '?>' also in scripts, to work what so ever.
3) Make sure executable (e.g. chmod a+x)

Note: Difference in how works on 1&1:

With '!/usr/bin/php ' as shebang:

(uiserver):uXXX:~/comgt-com/... > ./printenv.php
X-Powered-By: PHP/4.4.9
Content-type: text/html

With '!/usr/bin/env php ' as shebang:

(uiserver):uXXX:~/comgt-com/... > ./
X-Powered-By: PHP/5.5.30
Content-type: text/html


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 running a number of scripts (mostly Perl).

Older Material / Archive

Macintosh Notes

(Added 2009-09-08)

Standard installation - that is part of standard Mac OS X 10.6 - still isn't including (e.g.) mcrypt.

(Compare what was installed 2009-09-08 on MacMini (PHP 5.2.9, Entropy release 7) and standard OS X 10.6 (PHP 5.3.0). See all saved static phpinfo() results. Note: MacMini config retrieved via

Better to download and install Entropy's (which did earlier on Mac OS X 10.5).


Download (v5.3.0): (53.4 MB, can take quite a while... At least half hour. Seems like Entropy has a slow server - other communications are working quite fine when downloading this in 2009-09-08 ~15:30 US Central Time).

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/