Symptoms

A customer created an Apache website in Operations Automation (OA) and uploaded PHP scripts on the website or installed a PHP-based APS application.

The custom PHP scripts or installed APS application written in PHP do not work and the browser shows an "HTTP 500" error:

Error occurred: 500 - internal server error
Apache Server at: www.customer.com

At the same time, static HTML pages on the website work without any issues.

The following error message appears in the Apache error log when the "HTTP 500" error is displayed in the browser:

Premature end of script headers: php-cgi

Cause

The most probable cause is that PHP cannot be executed because the memory limit set for the Apache website is too low.

The memory limit is controlled by the RLimitMEM parameter in the Apache configuration file vhost.conf in the customer's webspace. POA calculates the value of the RLimitMEM parameter based on the values set in the activation parameters in the corresponding resource type. This is based on the Physical hosting (Apache) resource class in the customer's subscription, or in the Service Template the customer's subscription is based on:

  • Memory consumption limit (MB)

  • Limit of simultaneous requests

The value of the RLimitMEM Apache parameter is calculated as Memory consumption limit (MB) / Limit of simultaneous requests. If the result of a division is less than the minimum possible value (1), the minimum possible value (1) is used.

Note: If PHP is planned to be used in CGI application mode, you need to include an additional amount of RAM for the script engine itself (50 MB on an x32 web server; 150 MB on an x64 web server). In this case, the value of the Memory consumption limit parameter is calculated in the following way: <RAM for website> + <RAM for PHP script engine> * Limit of simultaneous requests per Virtual Host.

Resolution

  1. Find the Linux Shared Hosting server where the customer's website is located and the ID of the corresponding webspace. The hostname of the hosting server can be found in the Provider Control Panel at Service Director > Shared Hosting Manager > Websites. The ID of the webspace where the website is located can be found on the same screen:

  2. Log into the appropriate hosting server using SSH.

  3. Find the Apache memory limit (in bytes) for the customer's website in the "vhost.conf" file in the webspace. The default path to the "vhost.conf" file is /usr/local/pem/vhosts/WEBSPACE_ID/webspace/conf/vhost.conf, where WEBSPACE_ID is the ID of the customer's webspace you found in step 1:

    # grep RLimitMEM /usr/local/pem/vhosts/WEBSPACE_ID/webspace/conf/vhost.conf
    
  4. If the value of the RLimitMEM parameter is too low (e.g., 10-20 MB), consider increasing it: either increase the value of the Memory consumption limit parameter or decrease the value of the Limit of simultaneous requests parameter in the corresponding Apache resource type included in the customer's subscription, or the Service Template the customer's subscription is based on. Use the instructions in Knowledgebase article #115974, How to update Apache website limits, to apply changes to existing customer subscriptions.

Internal content