Resolve PHP page display errors on Web Hosting

更新时间:
复制 MD 格式

After you deploy a PHP website on Web Hosting, incorrect environment configurations can cause session cache failures, which can lead to page display errors when you access your PHP website. This article describes the possible causes and a solution.

Symptoms

Your PHP website runs correctly on other servers, on other platforms, or in a local test environment. However, after you deploy the PHP website to Web Hosting, you encounter code errors when you access the site. Common error messages include the following:

  • Issue 1:

    session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /includes/ecapp.base.php:4312)
    Error File: /includes/libraries/session.lib.php at 390 line.
  • Issue 2:

    warning:session_start():Cannot send session cookie - headers
  • Issue 3:

    Warning: Cannot modify header information - headers already sent by (output started at /data/home/qxu00000****/htdocs/wp-admin/setup-config.php:334) in /data/home/qxu00000****/htdocs/wp-admin/setup-config.php on line 75

Possible cause

This issue can occur if an incorrect environment configuration causes a session cache failure. You can enable the output buffering feature in the Web Hosting console to improve output control and page load speed, thereby resolving these page display errors.

Important

Application code issues can also cause website errors. If the problem persists, contact your application developer.

Solution

Note

If you have issues logging in to your site's admin panel and have already ruled out code-related problems, follow these steps.

  1. Log on to the web hosting management page.

  2. Find the target Web Hosting instance and click Manage in the Actions column.

  3. In the left-side navigation pane, choose advanced settings > php.ini settings.

  4. On the php.ini settings page, in the PHP Environment Parameters section, set output buffering to enabled.

  5. Click save settings, and then click Confirm.

    By default, output buffering is disabled. When enabled, this feature allows PHP to store output in a memory buffer before sending it to the browser.

  6. Clear your browser cache and access your website again.

    • If you can access the site normally, the issue is resolved.

    • If the issue persists, contact your application developer to investigate the code.