skip to primary navigationskip to content


PHP is installed by default. In Debian 9 (Stretch), the version of PHP is  7.0.33. If you are adapting PHP code written in PHP 5.6, there is documentation on the differences between these two versions in the PHP manual pages on migration and deprecated functionality removed.

Files with any of the following suffixes will be processed by PHP:

  • .php
  • .php3
  • .php4
  • .php5
  • .php7
  • .pht
  • .phtml

Files ending .phps are assumed to be PHP source and access to them is blocked.

The standard php.ini shipped by Debian is used. For scripts run by the web server this configuration can be found in /etc/php/7.0/apache2/php.ini and the files in /etc/php7.0/apache2/conf.d (command line scripts the configuration is in /etc/php/7.0/apache2/cli/php.ini and the files in /etc/php/7.0/cli/conf.d).

You can't edit these files, but for scripts executed by Apache you can override many settings in .htaccess files using the php_value and php_flag directives. See PHP's pages on how to change configuration settings. You might in particular need to do this to increase the values of post_max_size and upload_max_filesize which control the maximum size of a file that can be uploaded through PHP. For example:

php_value post_max_size 20M
php_value upload_max_filesize 20M

PHP scripts will be run as the www-data user. The www-data user and all other users of your server are member of the www-data group. This is different from the situation in many commercial hosting environments where PHP scripts are run as same user as owns the entire web site.

Additional Libraries

You can install PHP libraries from the Control Panel > Server settings:

mws cp phplib 

A long list of options will become visible once you start typing the name of the library you want to install.

php lib options

If you select your choice from the list, it will then appear on the screen with the check box by it, which you can select if you want to remove the library again:

phplib selected


Error messages generated by PHP scripts being run by Apache are recorded in the Apache error.log file in the logs directory.