PHP (PHP: Hypertext Preprocessor) is an HTML-embedded script language. A large part of the syntax originates from programming languages C, Java and Perl with a number of PHP-specific features added. The purpose of PHP is to enable web developers to write dynamically generated pages quickly. PHP can also be used as a CGI parser.

In addition to Active Server Pages (ASP), which has native support, you can also use PHP.

What can PHP be used for?

PHP is suitable for many purposes. It really comes into its own if used for dynamic web sites, for example:

  • Guest books
  • Forums
  • Front ends for search engines
  • Web shops

Files that contain PHP script must have the .php extension. The current version on our servers is PHP 5.3.2 and 5.2.13, see also the Changelogs.

If you encounter any problems, you can of course always contact our customer service, preferably via the Support section at MyVevida. Do include additional information, such as where we can find your scripts, etc. We cannot guarantee that we can solve your problems. For this reason, first try to find your answer via the internet.
You can find links to sites about PHP on our “Links to miscellaneous (technical) information” page. You can retrieve information about our PHP configuration settings using the phpinfo() function.

Redirecting domains in PHP

Since it is not possible to link domains at DNS level in our system, you can link domains with the following PHP script:

header("HTTP/1.0 301 Moved permanently");

Enter these five lines into a default.php file that is otherwise empty. Upload this to the /www-directory of If visitors to the Internet now retrieve they are automatically redirected to without noticing this.

For a temporary redirect, you must use a 302 Moved Temporarily HTTP code. Information about this is given in RFC 2616. For more information and the use of subdomains in PHP, see the DNS and subdomain page.

Date notation

You can use the following script to present a date notation in PHP in Dutch:

$weekday = array(
$months = array(
list($wday,$mday,$month,$year) = split("( )",date("w j n Y"));
$month -= 1;
$this_day = "$weekday[$wday], $mday $months[$month] $year";
echo ("$this_day");

Including other PHP files

<?php include("d:/www/"); ?>


<?php include("bestand.php"); ?>

Absolute path references

PHP does sometimes cause problems in case of an absolute reference, for example:
$basepath = ‘d:/www/’;
If this connection fails to be established, you can enter the following:
$basepath = ‘../../database’;
as a virtual (relative) path.

In a virtual hosting environment, such as at VEVIDA, the reserved variable $_SERVER[‘DOCUMENT_ROOT’]; is not available. You can work around this in scripts by defining the DOCUMENT_ROOT itself:

$_SERVER['DOCUMENT_ROOT'] = "D:/www/";

Unlinking / Deleting files

To delete files via PHP you can use the unlink function:


Make sure that the folder where the file to be deleted is located has write permissions.

PHP 5 connection to an Access database

To set up a connection from PHP 5 to an Access Database you can use the sample code below (DSN-Less).

Via the OLE DB Data Providers:

$db = realpath("d:/www/");

$dbc = new COM('ADODB.Connection');

// Access 2000, 2003 en Access 2007
$dbc->Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=$db");
// Access 2000, 2003
// $ dbc->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");

$sql = "SELECT Veld1 FROM Table1";
$rs = $dbc->Execute( $sql );
while(!$rs->EOF) {
  echo $rs->Fields['Veld1']->Value ."<br />";

// sluit de geopende objecten af


// Het relatieve pad naar de database
$db = realpath("../database/db.mdb");

// Maak het Object aan.
// let-op: U kunt geen gebruik maken van de 'or die ("error")'
$conn = new COM("ADODB.Connection");
// Microsoft Access connectie string.
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

// Voer de sql-query uit
$rs = $conn->Execute("SELECT Veld1 FROM Table1");

// laat alle resultaten zien
while(!$rs->EOF) { 
  $fv = $rs->Fields("Veld1");
  echo "Veld1: ". $fv->value ."<br>n";

// sluit de geopende objecten af

More information:

Generating PDF files

The PHP script language can be used to generate PDF files on the fly. This can be done with PDFlib (PDF Library ( website)). This is a standard component of PHP version 4.
PHP version 5 is standard in the VEVIDA hosting environment, PDFlib is not included in this.

The free FPDF class can be used to generate PDF files, or a free class as presented in a Zend tutorial on generating PDF files on the fly using PHP:

Code snippets

Code snippets are small pieces of usable code, for new and existing scripts. The following piece of code generates a random password.

// tellen hoeveel (milli-)seconden het duurt voor een
// script uitgevoerd is.
$stime = gettimeofday();
... // verdere PHP-code
$ftime = gettimeofday();
$time = round(($ftime['sec'] + $ftime['usec'] / 1000000) +- ($stime['sec'] + $stime['usec'] / 1000000), 5);
echo 'Generated in '.$time.' s.';
// genereert een willekeurige string tekens, minimaal 8 en maximaal 17 tekens lang
function keygen($tekens = false) {
  if(!$tekens) {
    $tekens = (int) "17";

  $sleutel = "";
  $array = array ("a", "b", "c", "d", "e", "f", "g", 
  "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", 
  "r", "s", "t", "v", "x", "y", "z", 1, 2, 3, 4, 5, 
  6, 7, 8, 9, 0, "-", "", "+", "=", "_", "|", "/", 
  ",", "<", ".", ">", "?", ";", ":", """, "'", "A", 
  "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", 
  "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", 
  "V", "W", "X", "Y", "Z", "[", "]", "{", "}");

  for ($i = 8; $i < $tekens; $i++)
    $sleutel .= $array[rand(0, 80)];
  return $sleutel;

echo keygen();

PHP performance tips

Google published an article written by Eric Higgins (Google webmaster), under the name “Let’s make the web faster, PHP performance tips“.
In addition to various coding standards, it is a good idea to follow such recommendations and guidelines, even if it only speeds up your website by 0,(0)1? seconds. Your code remains easier to read, contains less errors and therefore also fewer vulnerabilities.

Coding standards:


The Windows Cache Extension for PHP (WinCache) will be switched on as standard for PHP version 5.3. WinCache caches the PHP code export, making your website function faster.

« Back

Customer service

Cannot find what you are looking for? Please contact our customer service:

We are glad to be of service.