PHP configuration

Last change on 2023-03-17 • Created on 2020-01-20 • ID: KO-1B93B

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 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 .php82 -> PHP 8.2
  • File ending .php81 -> PHP 8.1
  • File ending .php80 -> PHP 8.0
  • File ending .php74 -> PHP 7.4
  • File ending .php73 -> PHP 7.3
  • File ending .php72 -> PHP 7.2

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:

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

PHP8.0

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

PHP8.1

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

PHP8.2

FcgidWrapper "/home/httpd/cgi-bin/php82-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/php74-fcgi-starter.fcgi" .html
FcgidWrapper "/home/httpd/cgi-bin/php74-fcgi-starter.fcgi" .htm
<FilesMatch "\.(html|htm)$">
 SetHandler fcgid-script
</FilesMatch>

(Example for PHP 7.4 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 7.2-CLI: /usr/bin/php72
  • PHP 7.3-CLI: /usr/bin/php73
  • PHP 7.4-CLI: /usr/bin/php74
  • PHP 8.0-CLI: /usr/bin/php80
  • PHP 8.1-CLI: /usr/bin/php81
  • PHP 8.2-CLI: /usr/bin/php82

You can also change the PHP version of the current SSH session as follows:

export PHPVERSION=8.0

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.

allow_url_fopen

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.

allow_url_include

If you activate this option, you can incorportate content from foreign sites per include. (allow_url_fopen 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.!

magic_quotes_gpc

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 magic_quotes_gpc. 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 https://www.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.

max_execution_time

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

upload_max_filesize

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

max_file_uploads

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: https://www.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