PHP configuration

Last change on 2021-07-07 • Created on 2020-01-20

In this section you can change the most important PHP configuration settings for your account.

Please note: We assume no responsibility for PHP scripts that do not function correctly as a result of incorrect settings. You are responsible for understanding the purpose of each of these configuration variables and how they affect your scripts.

Some of the settings affect the security of your account.

PHP version

You can set up the standard PHP version. All files ending in «.php» are automatically parsed with this PHP version. In addition, the following attributions are standard:

  • File ending .php74 -> PHP 7.4
  • File ending .php73 -> PHP 7.3
  • File ending .php72 -> PHP 7.2
  • File ending .php71 -> PHP 7.1
  • File ending .php56 -> PHP 5.6

It is also possible to set up the PHP version in the directory. Set up a file in the desired directory called «.htaccess» with the following content:

PHP5.6

FcgidWrapper "/home/httpd/cgi-bin/php56-fcgi-starter.fcgi" .php

PHP7.1

FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .php

PHP7.2

FcgidWrapper "/home/httpd/cgi-bin/php72-fcgi-starter.fcgi" .php

PHP7.3

FcgidWrapper "/home/httpd/cgi-bin/php73-fcgi-starter.fcgi" .php

PHP7.4

FcgidWrapper "/home/httpd/cgi-bin/php74-fcgi-starter.fcgi" .php

Configure other extensions (like .html) for PHP

If you want to parse .html files or any other file extension by PHP, you need to add the following to your .htaccess file.

FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .html
FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .htm
<FilesMatch "\.(html|htm)$">
 SetHandler fcgid-script
</FilesMatch>

(Example for PHP 7.1 and .htm/.html files)

PHP-CLI (command line)

You can use the following PHP command line interpreter (CLI): Note: The command line call php or /usr/bin/php now uses the PHP version set in the konsoleH under "Settings" > "PHP configuration".

  • PHP-CLI (the set php version): /usr/bin/php
  • PHP 5.6-CLI: /usr/bin/php56
  • PHP 7.1-CLI: /usr/bin/php71
  • PHP 7.2-CLI: /usr/bin/php72
  • PHP 7.3-CLI: /usr/bin/php73
  • PHP 7.4-CLI: /usr/bin/php74

PHP options

Not all the configuration settings offered are available for all versions of PHP. There is a help text for each setting that explains which version of PHP each setting corresponds to. You will also see a hint if a setting is not available for your chosen default version of PHP. However, the setting might be used if you have set up a PHP version in a directory via .htaccess.

display_errors

If you activate this option, PHP errors will be visible in the browser.

allowurlfopen

If you activate this option, you can incorporate content from foreign sites.

Warning: If you make programming mistakes with this function, you may accidentally make it possible to introduce malicious code into your account.

allowurlinclude

If you activate this option, you can incorportate content from foreign sites per include. (allowurlfopen also needs to be active!)

Warning: If you make programming mistakes with this function, you may accidentally make it possible to introduce malicious code into your account.!

magicquotesgpc

If this option is activated, information between inverted commas is masked. This reduces the likelihood of successful attack on badly programmed PHP scripts. Only deactivate this option if you insert scripts which do not function with active magicquotesgpc. Warning: With bad programming this function can lead to malicious code being introduced into your account!

expose_php

If you activate this option, the PHP version you use is disclosed in HTTP page headers.

mbstring.func_overload

This option is needed by some scripts to handle UTF8 data correctly. See http://php.net/mbstring.overload in the PHP manual for further details.

memory_limit

This is the maximum available storage for your PHP scripts. Only increase this value if necessary.

maxexecutiontime

This is the maximum available time (in seconds) for running your PHP scripts. Only increase this value if necessary.

uploadmaxfilesize

This is the maximum size for uploaded files. Only increase this value if necessary.

maxfileuploads

This is the maximum number of simultaneous uploads. Increase or decrease this only if you really need to.

extension/zend_extension

This lets you embed PHP extensions «ImageMagick», «MongoDB», OPCache», «Zend Optimizer/Zen Guard», «IonCube Loader», «APCu» or «Source Guardian» if needed. The additional modules are required by some scripts or generally improve PHP performance. To see if this is the case, check the script documentation. Warning: Not all combinations of these extensions are compatible. If you encounter problems after activating one of these extensions, please deactivate the extension.

More settings

You can easily set a lot of PHP settings directly via .htaccess file:

php_value [Setting_1] [value]
php_flag [Setting_2] [0 or 1]
  • Use php_value for all settings requiring a value (number or string).
  • Use php_flag for PHP settings which can only be turned on or off.

You can find a comprehensive overview of all configuration settings which you can set in the PHP manual: http://php.net/manual/en/ini.list.php

PHP error log

To log PHP errors, you need to first add an empty log file (e.g. over FTP). After that, add the following lines to your .htaccess file to activate the error log:

php_flag  log_errors on
php_value error_log  /usr/home/«login»/php.log

(In this example, the file is php.log and is in the home folder of the account. You need to replace «login» with the FTP user name of the account.)

Table of Contents