KNOWNHOST WIKI

User Tools

Site Tools


developmental:what-is-the-premature-end-of-script-headers-php-error

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developmental:what-is-the-premature-end-of-script-headers-php-error [2015/01/18 22:24]
Jonathan W.
developmental:what-is-the-premature-end-of-script-headers-php-error [2020/05/13 13:37] (current)
Karson N.
Line 3: Line 3:
 <​code>​Premature end of script headers: /​home/​user/​public_html/​index.php</​code>​ <​code>​Premature end of script headers: /​home/​user/​public_html/​index.php</​code>​
  
 +\\
 ===== Why does it happen? ===== ===== Why does it happen? =====
 Premature end of script headers "​actually means",​ the script stopped for whatever reason before it returned any output to the web server. This can be an extremely difficult error to diagnose. Premature end of script headers "​actually means",​ the script stopped for whatever reason before it returned any output to the web server. This can be an extremely difficult error to diagnose.
  
 +\\
 ===== Debugging Premature end of script headers / Solutions ===== ===== Debugging Premature end of script headers / Solutions =====
  
 Some suggested areas to consider or debug for the loathed '//​Premature end of script headers//':​ Some suggested areas to consider or debug for the loathed '//​Premature end of script headers//':​
  
 +\\
 ==== PHP Version Changes ​ ==== ==== PHP Version Changes ​ ====
 Have you upgraded or downgraded your version of PHP recently? It is possible that your websites code/core functionality is not compatible with the version of PHP you've changed to.  Have you upgraded or downgraded your version of PHP recently? It is possible that your websites code/core functionality is not compatible with the version of PHP you've changed to. 
  
 +\\
 ==== Required File Path Changes ​ ==== ==== Required File Path Changes ​ ====
 If your website/​program uses the require_once() function, it specifically requires a file at a certain location. If you've changed/​renamed/​moved files or folders recently, this could be the casue of your issue. Also, one of the easiest fixes I might add. If your website/​program uses the require_once() function, it specifically requires a file at a certain location. If you've changed/​renamed/​moved files or folders recently, this could be the casue of your issue. Also, one of the easiest fixes I might add.
  
 +\\
 ==== CPU and Memory Limits ​ ==== ==== CPU and Memory Limits ​ ====
 The RLimitCPU and RLimitMEM directives in the httpd.conf may also be responsible for the error if a script was killed due to a resource limit. Check your httpd configuration file ( ''/​usr/​local/​apache/​conf/​httpd.conf''​ ) for any ''​RLimitCPU''​ or ''​RLimitMEM''​ settings and adjust them accordingly. The RLimitCPU and RLimitMEM directives in the httpd.conf may also be responsible for the error if a script was killed due to a resource limit. Check your httpd configuration file ( ''/​usr/​local/​apache/​conf/​httpd.conf''​ ) for any ''​RLimitCPU''​ or ''​RLimitMEM''​ settings and adjust them accordingly.
  
 +\\
 ==== Thirdy Party Apache Modules ​ ==== ==== Thirdy Party Apache Modules ​ ====
 A configuration problem in suEXEC, mod_perl, or another third party module can often interfere with the execution of scripts and cause the error. If these are the cause, additional information relating to specifics will be found in the apache error_log. A configuration problem in suEXEC, mod_perl, or another third party module can often interfere with the execution of scripts and cause the error. If these are the cause, additional information relating to specifics will be found in the apache error_log.
  
 +\\
 ==== HUGE Log File ==== ==== HUGE Log File ====
 If suPHP’s log reaches 2GB in size or larger you may see the premature end of scripts headers error. See what the log contains and either gzip it or null it. Restart apache and then deal with any issues that the suphp log brought to light. The suphp log is located at: ''/​usr/​local/​apache/​logs/​suphp_log''​ If suPHP’s log reaches 2GB in size or larger you may see the premature end of scripts headers error. See what the log contains and either gzip it or null it. Restart apache and then deal with any issues that the suphp log brought to light. The suphp log is located at: ''/​usr/​local/​apache/​logs/​suphp_log''​
  
 +\\
 ==== Permissions ==== ==== Permissions ====
 The script’s permissions may also cause this error. CGI scripts can only access resources allowed for the User and Group specified in the httpd.conf. In this case, the error may simply be pointing out that an unauthorized user is attempting to access a script. The script’s permissions may also cause this error. CGI scripts can only access resources allowed for the User and Group specified in the httpd.conf. In this case, the error may simply be pointing out that an unauthorized user is attempting to access a script.
  
 +\\
 ==== Enable Error Reporting ==== ==== Enable Error Reporting ====
 Enabling error reporting on a PHP version of a website could help diagnose the error more in depth. Add the following snippet to your index.php file of the related site for possible additional information: ​ Enabling error reporting on a PHP version of a website could help diagnose the error more in depth. Add the following snippet to your index.php file of the related site for possible additional information: ​
   * ''<?​php error_reporting(E_ALL);​ ?>''​   * ''<?​php error_reporting(E_ALL);​ ?>''​
  
 +\\
 ==== Where'​s the whitespace?​! ==== ==== Where'​s the whitespace?​! ====
 Sometimes this error can be related to a trailing whitespace or returns after your closing ''?>''​ in the script/​site. Sometimes this error can be related to a trailing whitespace or returns after your closing ''?>''​ in the script/​site.
  
 +\\
 ===== Content Management Systems ===== ===== Content Management Systems =====
 If you are using a commonly used Content Management System (ex. WordPress, Drupal, Joomla, etc.) there are numerous references to these errors available online. It's beneficial to note any plugins, themes, or add-ons that you've recently installed as well as the version number of the installed CMS when searching for the issue. If you are using a commonly used Content Management System (ex. WordPress, Drupal, Joomla, etc.) there are numerous references to these errors available online. It's beneficial to note any plugins, themes, or add-ons that you've recently installed as well as the version number of the installed CMS when searching for the issue.
  
 +\\
 ===== Similar Articles ===== ===== Similar Articles =====
 [[developmental:​what-is-the-headers-already-sent-php-error|"​headers already sent" PHP error]] [[developmental:​what-is-the-headers-already-sent-php-error|"​headers already sent" PHP error]]
developmental/what-is-the-premature-end-of-script-headers-php-error.txt · Last modified: 2020/05/13 13:37 by Karson N.