Frequently asked questions

Back
How do I change the PHP configuration for my web hotel?
This entry in our frequently asked questions is directed to advanced users, everything you do is at your own risk and responsibility.

Note! If you change your PHP configuration, things may stop working, either immediately or later. See here for info about PHP 5.6, and here for info about php 7.0.


General info

Our webservers' standard PHP configuration is good enough for the majority of applications. If you know you need different config settings, you may customize the configuration at your own risk. Such customization may be:

  • IonCube or Zend Guard Loader
  • Settings for error display, timezone, etc.
  • Resource limits, e.g. memory (memory_limit, post_max_size, upload_max_filesize), runtime (max_execution_time, max_input_time) etc. MAY NOT be INCREASED or EXCEEDED.

As opposed to mod_php based solutions, you cannot customize PHP config settings directly in .htaccess.

If you try to do so, you will get "internal server error".

If you customize settings as those mentioned above, and you get errors or malfunctions in your software, double-check that you have not typoed or made other mistakes in your customizations. If you cannot make it work at all, leave it to an expert, or revert to our standard configuration. We cannot provide support for such customization.

If you increase or exceed resource limits (which is not permitted), we may have to deactivate the PHP code in question and/or the configuration file. If your resource needs are greater than which we can provide, you should use a dedicated server or virtual private server.

PHP is configured at several levels

  1. Runtime level (in the PHP script, PHP_INI_USER, PHP_INI_ALL, ini_set()
  2. Directory level (you decide, PHP_INI_PERDIR, use .user.ini)
  3. System level (central configuration, we decide, "Master value", PHP_INI_SYSTEM and our php.ini)
  4. Hardcoded level (PHP compilation/installation, we do not change anything from Debian's defaults)

PHP's web pages have an overview over available settings.

Configuration of the PHP_INI_USER and PHP_INI_ALL types can be set in each script (or an include file), regardless of the installed PHP version.


ini_set()

PHP_INI_USER
PHP_INI_ALL

Most requests for system level changes to variables are unnecessary, the PHP developer/maintainer may set these in the program/script by using ini_set(), and it's very easy to check and confirm settings with ini_get().

Example ini_set() usage

<?php
  ini_set("display_errors",1);
  print(ini_get("date.timezone")."\n");
  ini_set("date.timezone","Europe/Berlin");
  print(ini_get("date.timezone")."\n");
?>

If you need to configure the timezone, replace Europe/Berlin with the timezone you require. Standard for our PHP is "Europe/Oslo", so you may wish to change that.


.user.ini

PHP_INI_PERDIR
PHP_INI_USER

Some settings cannot be performed in a program/script. If you create your own .user.ini in the www folder, you only need to specify your customizations, as opposed to in php.ini, where you also must specify those you don't customize.

Example .user.ini

display_errors = On
date.timezone = "Asia/Jakarta"

If you need to configure the timezone, replace Asia/Jakarta with the timezone you want to use. See also PHP's supported timezone list.


php.ini

Because our PHP 5 installation is using uWSGI, you have the option of creating your own php.ini, and therefore also changing settings of the types PHP_INI_SYSTEM and php.ini. Copy and use our standard php.ini for PHP 5.6 or for PHP 7.0 as a basis for your settings.

It may take up to thirty (30) minutes for changes to php.ini to take effect.

Do not create your own php.ini from scratch, unless you include all our preconfigured variables!

Here is how to create your own php.ini:

  1. Download and copy our standard php.ini for PHP 5.5 or for PHP 7.0 to your webhotel, e.g. /home/2/m/myname/php.ini. It is not recommended to leave this file readable by others. Do not create your own php.ini from scratch.
  2. Customize the file according to your needs.
  3. Changes to .user.ini and php.ini are not active immediately, but after respectively 5 and 30 minutes.
  4. Support for IonCube Loader and Zend Guard Loader (PHP 5.6 only) may be activated via the webhotel's control panel. This will deactivate the option of using your own php.ini. This is an advantage to using your own php.ini and downloading your own loader/extension.
  5. Pay attention to changes we make in our php.ini!

To verify that your customizations have been loaded, check the configuration settings with phpinfo(), where the value "Loaded Configuration File" will display the name of the configuration file that was loaded. If it displays e.g. "/etc/php5/embed/php.ini", your setting was not successful. Check your php.ini, and try again.

If you get an "internal server error" message, you've probably made a mistake, such as trying a setting that's invalid, using the wrong file permissions (PHP-scripts on our webservers must not be writeable for others), etc.


Extensions, modules, and plugins

Many extensions can be installed in your own webhotel and loaded by a modified php.ini. They cannot be loaded with .user.ini.

We do not provide support for such extensions, even if a very nice support person helped you install it the first time.

Several such extensions are so-called PHP accelerators or "optimizers", which essentially offer you the following two services:

  1. Theoretical performance improvements
  2. Obfuscated/encrypted source code

The theoretical performance improvements will often backfire as lost performance, because the accelerators assume that PHP is running as integrated, optimizable code (mod_php) in the webserver itself. Our webservers run PHP as CGI under uWSGI for added security, which means that your main interest will probably be in obfuscation/encryption.

Some PHP software require e.g. IonCube, your software vendor will provide you with the information necessary for deciding what to use. We do not provide support for such extensions.

The examples below are provided for your convenience only, and you may use them as examples on how to load extensions in general, at your own risk and responsibility.


IonCube

IonCube

NOTE: We do not provide support for IonCube.

Users of PHP do not need their own php.ini. Instead, we recommend that you select IonCube in our control panel, click on "View/change" next to "PHP". The change may take 10-30 minutes.

You cannot have your own php.ini with this option. This is a simplification in, so that you won't have to figure out how to load IonCube via php.ini.

If you have an extension from IonCube, make sure that you use the version for Linux (x86-64) and your webhotel's PHP version. You can load it by adding a separate line in your php.ini. We do not provide support for IonCube.

Use the Linux (x86-64) version. The x86 version may also work.


Zend Optimizer/Zend Guard Loader

Zend Guard Loader for PHP 5.6

NOTE: We do not provide support for Zend Guard. Zend Guard does not exist for PHP 7.x.

Users of PHP 5.6 do not need their own php.ini. Instead, we recommend that you select Zend Guard in our control panel, click on "View/change" next to "PHP". The change may take 10-30 minutes.

You cannot have your own php.ini with this option. This is a simplification in, so that you won't have to figure out how to load Zend Guard via php.ini.

If you experience problems, consult the user guide/documentation for your software and Zend Guard Loader, and if necessary, contact your software vendor's support service.


PECL/PEAR extensions (e.g. Imagick

Imagick and many other extensions are pre-installed and active.

To get a list of our installed and activated PECL/PEAR extensions, either use phpinfo() or login to login.domeneshop.no and enter the command pecl l and/or pear l.

You are free to install further PECL extensions to your own webhotel, but not to our central servers. This is at your own risk. We do not provide support for this.


Custom extensions

If you need to add/activate additional extensions, PHP permits the use of the module's complete path in php.ini. This allows the use of both modules installed by us, and those you choose to install yourself. As an example, you can use:

extension=/home/1/m/myname/my_extension.so

This is also at your own risk and responsibility.


See also:

Keyword:  

Index

© 2017 Domeneshop AS · About us · Terms & Conditions · About cookies