Mod fcgid php timeout

Script headers terminated early due to Mod_fcgid’s data read timeout

Upon scrutinizing the error logs, a set of errors appears to have been triggered while loading the page. To address this, it is recommended to augment the PHP error reporting level within Plesk > Domains > example.com > PHP Settings, and assess the script in question.

Mod_fcgid read data timeout — Premature end of script headers

The Plesk users I’m working on has websites that cannot be reached due to a 500 Internal Server error error. Upon checking the user’s error_log, multiple issues were identified.

[warn] mod_fcgid: read data timeout in 60 seconds [error] Premature end of script headers: index.php 

The DocumentRoot has a standard installation of WordPress. There are other websites that also use the same WP version, DB server, and PHP+Extensions, and they work properly. Additionally, a specific is working fine. However, php index.php is a bit slow when accessed from cli returns webpage, even though it is hosted on an idle Xeon E5-2620 Server with 64GB RAM.

Are there any issues that are currently recognized? How can I engage in further troubleshooting?

Presently, the website is loading a bit slowly, but there is no occurrence of a 500 error, indicating that the issue is intermittent. To eliminate the possibility of the issue being a configuration limitation, the memory_limit has been increased.

You may refer to the instructions provided in this article https://kb.plesk.com/en/121251 to extend the FcgidIOTimeout.

Since Plesk 11.5, «FcgidIOTimeout» parameter is set to the same value as max_execution_time php parameter in domain’s PHP settings

To circumvent the internal performance limitations that can’t be overcome, it’s recommended that you experiment with any of the PHP-FPM handlers instead of FastCGI as an alternative.

The issue arose due to an unauthorized file_get_contents that was present in certain scripts.

After examining the error log, I came across a file that was generated at the exact time the error message first appeared. This PHP file seems to be suspicious.

After successfully eliminating the malware, which you can read about in a comprehensive report found at https://talk.plesk.com/threads/debugging-premature-end-of-script-headers .338956/, I rebooted the server and the error has disappeared.

The technical issue arose due to the offline status of the malware-distributing Server. Consequently, the local script failed and returned an error message as file_get_contents(«http. » timed out.

Php — Premature End of Script Headers?, Stack Overflow Public questions & answers; Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Jobs Programming & related technical career opportunities; Talent Recruit tech talent & build your employer brand; Advertising Reach developers & technologists …

Читайте также:  Html тілінде практикалы ж мыстарды орындау 10 сынып

Premature end of script headers index.php, mod_fcgid

Premature end of script headers index.php, mod_fcgid read data timeout in 61 seconds — PHP [ Glasses to protect eyes while codiing : https://amzn.to/3N1ISWI

Mod_fcgid: read data timeout in 45 seconds and Premature end of script headers: index.php

Upon investigating my error log, I noticed that a customer from my website was encountering problems during the order placement process.

[warn] mod_fcgid: read data timeout in 45 seconds, referer: https://myDomain/cart [error] Premature end of script headers: index.php, referer: https://myDomain/cart 

Could you provide an explanation of the meaning of this error message? Is there a solution to remove this error, such as modifying any settings in Plesk Control Panel? Would changing ‘max_execution_time’ to 3600 in ‘PHP settings’ be effective in resolving the issue?

I have CentOS 5.11 and Plesk version 12.0.18 installed.

The website code located in index.php file is unable to execute within the designated time limit set for Apache FastCGI module and/or PHP, resulting in an error.

  • Most likely, there is an error in the index.php , which makes it inoperable at all. In this case, you should increase the PHP error reporting level in Plesk > Domains > example.com > PHP Settings and review the script itself.
  • Less likely that script is meant to take a long time to execute. In this case, you may simply increase timeout via Plesk. To set 120 seconds instead of default 45, do the following:

Assign the value of 120 to max_execution_time under the PHP settings of example.com domain in Plesk.

Add the below Apache directives to enhance FastCGI timeout by navigating to Plesk > Domains > example.com > Apache & Nginx settings > Additional Apache directives.

Premature end of script headers index.php, mod_fcgid, Premature end of script headers index.php, mod_fcgid read data timeout in 61 seconds — PHP [ Glasses to protect eyes while codiing : https://amzn.to/3N1ISWI

Timeout and premature end of script headers error in IE specifically

In most browsers everything is fine

The website displays a 500 error when using IE9/10.

The concerned page has been modified to prevent form re-submission UX bugs by incorporating post, redirect and get methods. Upon further investigation, I have included the complete URL, space and 303 response code in accordance with a related question.

Implementing the Post-Redirect-Get pattern on Internet Explorer.

In my situation, IE attempts to perform the redirect but instead of reaching the intended page, it simply reloads the current page. This results in either a temporary 500 error or IE bypasses the page reload and goes straight to the 500 error.

Upon reviewing the error logs, two errors appear to be triggered during the page loading process.

[12:55:33] [warn] mod_fcgid: read data timeout in 45 seconds, referer: h##ps://#######/make-model-search/ [12:55:33] [error] Premature end of script headers: index.php, referer: h##ps://#######/make-model-search/ 

In the realm of functional browsers, the page that users quickly depart from is the one that undergoes reloading — specifically, the make and model search page.

The inquiry proposes raising timeout values, but doesn’t address IE directly. However, increasing timeouts may not be the optimal resolution for a potential browser-specific issue.

Читайте также:  Php echo output html

To replicate the issue on the browser, navigate to http://www.easywheels.co.uk/ and input the registration code NA62EGU. Proceed by clicking on ‘find tyres’ followed by ‘accept and proceed.’ This will trigger the error on IE.

Have you attempted to resolve this issue by disabling server compression in IE? This solution has proven effective for me in the past when encountering similar errors.

RewriteEngine on RewriteCond % MSIE\ [56] RewriteCond % !SV1 RewriteCond % \.(css|js)$ RewriteRule .* - [E=REMOVE_IE_ACCEPT_ENCODING:1] RequestHeader set Accept-Encoding "" env=REMOVE_IE_ACCEPT_ENCODING  

Essentially, adjusting the headers related to Accept-Encoding is the task at hand. However, I am unable to locate my instructions for turning off compression for IE. Nevertheless, this is a suitable starting point. Occasionally, it is the enhancements that cause problems for us.

Upon some investigation, I have found a resource for deactivating compression. You can refer to this link: http://www.aptivate.org/webguidelines/EnablingCompressionOnYourWebServer.Apache2.html

Php — FastCGI Configuration errors, Stack Overflow Public questions & answers; Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Jobs Programming & related technical career opportunities; Talent Recruit tech talent & build your employer brand ; Advertising Reach developers & …

Premature End of Script Headers?

There appears to be an issue with the code as it is resulting in a premature execution error when utilizing header .

"; $append = ""; if (!isset($_SESSION['name'])) < header("Location: login.php"); >echo $prepend."Здравей ".$_SESSION['name'].$append."
"; if (isset($_POST['submit'])) < $newname = mysql_real_escape_string($_POST['newname']); $newpass = mysql_real_escape_string($_POST['newpass']); $oldpass = mysql_real_escape_string($_POST['oldpass']); $checkPass = "SELECT pass from admin WHERE pass = '$_POST[oldpass]'"; $rs = mysqli_query($connect,$checkPass); $data = mysqli_fetch_array($rs, MYSQLI_NUM); if ($data >0) < $query = "UPDATE admin SET pass ='".$_POST['newpass']."',name ='".$_POST['newname']."'" ; $result = mysqli_query($connect, $query); if ($result === true) < echo "Update sucessfuly!"; >> else < header('Location: admin.php?failed=1'); >> ?>

Upon opening the page, the else section is executed right away. I am perplexed as to why this occurs.

Your code contains two unusual lines that require attention.

$rs = mysqli_query($connect,$checkPass); $data = mysqli_fetch_array($rs, MYSQLI_NUM); 

The mentioned functions are absent, and it’s likely that you utilized the mysql_. () ones, which is supported by the earlier declarations.

$data = mysql_fetch_array($rs, MYSQLI_NUM); 

Within a loop, $data will either hold an array (representing the next record) or the value FALSE (if there are no more records to return).

In its present state, executing if ($data > 0) won’t yield any meaningful result as $data is an array.

To meet your requirements, it is necessary to modify the given code. This will ensure that the previous query has indeed identified pass .

Upon initial page opening, the else portion is triggered due to the absence of set session variables. Therefore, it is necessary to establish session variables before proceeding.

$_SESSION['sessionName']= $value; 

If you have executed this on a different page, kindly provide the code.

if(mysqli_num_row($data)>0) < $query = "UPDATE admin SET pass='".$_POST['newpass']."',name='".$_POST['newname']."'" ; $result = mysqli_query($connect, $query); if ($result === true) < echo "Update sucessfuly!"; >> else < header('Location: admin.php?failed=1'); >> ?> 

Apache — PHP + Imagick = Premature end of script, Teams. Q&A for work. Connect and share knowledge within a single location that is structured and easy to search.

Читайте также:  Abstract class implements interface java

Источник

mod_fcgid: read data timeout in 40 seconds

Если в логах сайта возникает ошибка mod_fcgid: read data timeout in 40 seconds, то это значит что апач через mod_fcgid передал некие данные php-скрипту на обработку, подождал 40 секунд и не получив ответа в этот срок возвратил ошибку (для посетителя она выглядит как 504).

Способы решения проблемы:

Способ первый — уменьшить время работы проблемного скрипта.

Часто проблемы такого рода возникают со скриптами обрабатывающими большое количество данных. В этом случае разбиение задачи на более мелкие части решает вопрос.

Ещё такая же ошибка может наблюдаться и в ситуации когда в процессе выполнения скрипта происходит обращение к какому-то внешнему ресурсу (например, к удалённому серверу), который на данный момент недоступен или просто «тормозит» не успевая дать ответ вовремя или не давая его вовсе. В этом случае нужно или восстановить доступность/быструю работу удалённого сервиса, или перейти к второму способу.

Способ второй — увеличить время ожидания mod_fcgid. Для этого откройте файл

  • в CentOS /etc/httpd/conf.d/fcgid.conf
  • в Debian/Ubuntu /etc/apache2/mods-available/fcgid.conf

И отредактируйте (если нету, то добавьте) строку:

, где вместо 300 — нужно подставить подходящее время ожидания. Слишком большое ставить не нужно.

Источник

mod_fcgid: read data timeout errors

These errors mean, that the scripts were running longer than 31 seconds and thus they were terminated, as your fcgid.conf says so. The standard timeout is 40 seconds btw.

You can easily check this behaviour by writing a test.php:

This should give you an error 500 and put this error in your logs.

You have two possibilities to solve this:

  1. Re-Make your index.php (or the application behind) and solve potential loop-issues (where the script runs forever and gets terminated after 31 seconds).
  2. Set the timeouts higher. This has to be done for every vhost (don’t forget SSL!), as this setting gets changed every time another vhost loads and will remain until the spawned process dies.
    Easiest way would be to edit /etc/apache2/mods-available/fcgid.conf . This is what we are using: IdleTimeout 3600
    ProcessLifeTime 7200
    IPCConnectTimeout 8
    IPCCommTimeout 600
    BusyTimeout 300

Edit: Oh, the second error is related to overly long query strings in URLs. To allow longer query strings, also edit fcgid.conf and insert

Don’t forget to restart apache to kill all running processes, so they get the new configs.

Solution 2

mysqldump by default will write lock the database while it runs so the data isn’t altered during the backup, which can cause corruption. Drupal writes to the database on every request, so requests will hang while mysqldump is running, and eventually timeout.

If you’re using InnoDB (or can convert to it), then you can use Percona XtraBackup to do hot backups. Short of that, don’t pipe mysqldump to tar or gzip; dump the .sql file and then run tar/gzip on it after mysqldump has completed (and released the lock).

Also be aware that in certain versions of fcgid, there’s a bug that causes it to only apply settings in VirtualHost blocks, and to apply those in the last-read block globally.

Источник

Оцените статью