ru en
Help
Print version

PHP — module setting, diagnostics and troubleshooting in scripts running

Contents

  1. General information
  2. Overview of management and configuration interfaces
  3. Diagnostics and troubleshooting in website scripts running

1. General information

Today PHP is one of the popular programming languages used for websites creation. On R01 hosting code of PHP scripts is processed by Apache web server module. Correct operation of website predetermines, in the first place, optimal and reliable operation of the website.

R01 hosting administrator has an opportunity of flexible configuration of PHP module, including selection of module version, connection of extensions, change of directives php.ini.

Presently, the following versions of PHP interpreter are available on R01 hosting:

  • 4.4
  • 5.1
  • 5.2
  • 5.3

Switching between versions is made in section "Web server" — "Modules management" of the hosting control panel (https://www.r01.ru, "Account manager" section). More information about this process is available in the following section.

Before starting PHP module configuration, it is first required to study specifications to hosting server and PHP settings referring to website script developers or CMS manuals.

2. Overview of management and configuration interfaces

PHP module management is carried out in section "Web server" — "Modules management" of the hosting control panel (https://hosting.r01.ru).

2.1. Selecting PHP module version

Ready-to-connect PHP modules are available in section "Web server" — "Modules management" of the hosting control panel (https://www.r01.ruhttps://www.r01.ru, "Account manager" section). To connect the version that suits your website needs, it should be checked and click on "Enable" in the low part of the page.

After connection of the required version of PHP module you may start its setup process. To do it, follow link "configure module".

PHP version is selected for all websites placed under this hosting service. Using separate versions for each website is impossible.

2.2. PHP Module Extensions Management

In the top part of the page with PHP module settings there is "PHP module extensions" block, where you can see the extensions which are activated at present moment.

To activate lacking extension:

  • in "PHP module extensions" block click on "Extensions management" link;
  • check item "All extensions";
  • in the opened list find the required extension, check it and save changes.

2.3. Changing PHP module settings (php.ini directives)

In the bottom part of the page with PHP module settings there is a table with variables. Set the required values in accordance with website script requirements and save changes.

 

2.4. Obtaining detailed information about PHP module settings

The control panel displays only extensions to be disabled. You can obtain full list of extensions and settings using phpinfo() function:

  • in directory docs of your website create file info.php with the following contents:

    <?
    phpinfo();
    ?>

  • refer to this script by the address http://your_domain/info.php — you will receive detailed information about PHP module.

Description of php.ini settings is available in official documentation at website http://php.net.

3. Diagnostics and debugging of website scripts

This section outlines typical errors occurred at website placement on hosting. In the event of an error which is not considered here we recommend that you first consult website developers.

3.1. A blank page is displayed instead of website contents

You will see a blank page, if an error encountered in process of scripts running. For the security reasons errors are not displayed on R01 hosting by default.

For the debugging purposes we recommend to enable errors display in PHP module settings. In this case a message will appear which bugs occurred at scripts running. Typical errors and debugging methods are given in the following sections of this instruction.

To enable errors display, in PHP module settings (as indicated in item 2 of this instruction) just opposite "All warnings and errors E_ALL" select "Yes" and save changes.

If the error is still not displayed, it means errors display option is disabled in configuration files or website scripts. To enable them we recommend consulting with website developers or refer to appropriate CMS documentation.

3.2. "Fatal error: Сall to undefined function…"

Similar errors occur, if PHP extensions required for website function are not available in web server configuration. Error message contains function name, by which the extension can be identified:

  • Fatal error: Call to undefined function simplexml_load_file() in ... — требуется расширение simplexml,
  • Fatal error: Call to undefined function mb_detect_encoding() in ... — требуется расширение mbstring,
  • Fatal error: Call to undefined function ctype_alpha() in ... — требуется расширение ctype.

Using website search http://www.php.net you can determine, which PHP extension the function is attributed to, if function name does not allow to explicitly identify the extension.

You may enable the appropriate extension as per item 2 of this instruction.

3.3. "Fatal error: Allowed memory size of XXX bytes exhausted…"

This error occurs, if the memory allocated for script running is exhausted. The amount expressed in bytes indicates current memory limit. This limit is set by memory_limit setting. You may change "Maximum memory capacity for script operation (memory_limit)" setting as per item 2 of this instruction.

If the error persists, it means this setting is reconfigured in configuration files or website scripts.

If there is not enough memory for script running at a maximum value memory_limit allocated for the plan, it may indicate that there is a bug in it. In this case we recommend consulting script developer.

3.4. Error "Headers already sent…"

In most cases this error is caused by a so called BOM-signature in website files. In the first place check configuration files of the website, in which you could introduce changes.

To solve this problem you should download these files to your computer, open and save them in UTF-8 code without BOM-signature. For this purpose, you should use any specialized text editor, for example notepad++, supporting files saving in UTF-8 code without BOM-signature. Standard Windows "Notepad" is a poor alternative in this case.

For editing purposes you may also use section "File manager" of the hosting control panel. At the very beginning of file, before opening PHP tag you will see three illegible characters. Delete them and save changes.

3.5. RAM shortage

If you see slow operation of website, unstable operation of a part of functions, for example mail dispatch mail(), check statistics of using resources provided in section "Web server" — "Resources usage" of the hosting control panel.

If memory graph reaches limitations of the RAM allocated for this plan, there may be unstable operation, partial or full unavailability of websites, whereas the server does not have enough resources to process incoming requests and run scripts.

A complex solution that will help reduce consumption of resources:

  • disabling Apache web server modules and PHP extensions which are unused by website scripts,
  • optimizing website scripts with a purpose to reduce memory use,
  • limiting activity of search engines using file robots.txt,
  • transfer to hosting plan with a large volume of memory.
Copyright © 2000-2024 Registrar R01
Information: info@r01.ru
Support: support@r01.ru
Office: 1 Bolshoy Gnezdnikovsky Lane, building 2, Moscow (Tverskaya metro station, entrance No. 9, Voznesensky business center)