FastCGI: comm with server “/usr/lib/cgi-bin/php5-fcgi” aborted: error parsing headers: duplicate header ‘Content-Type’
Qualche giorno fa abbiamo verificato che il Gestore dei file media, quello che si apre quando vogliamo inserire una immagine nel CMS per capirci, non mostrava le thumbnails delle immagini; scelta l’iimagine questa era però ben visibile sia nell’editor wysiwyg, sia nel frontend di Magento.
Controllando i log abbiamo riscontrato l’errore riportato sopra, ossia un
FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: error parsing headers: duplicate header 'Content-Type', referer: https://xxxxxx.xxx/index.php/admin/cms_wysiwyg_images/thumbnail/file/bG9nb19pZmJiLnBuZw--/key/3d37ff057d327cd0f3e001b16747fe5f/
Facendo una ricerca su internet abbiamo trovato questo utile post (qui), che spiega come l’errore sia dovuto ad una errata creazione dell’header inviato e come sia risolvibile sostiuendo la funzione sendHeaders() di app/code/core/Mage/Core/Controller/Response/Http.php con questa
public function sendHeaders()
{
if (!$this->canSendHeaders()) {
Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));
return $this;
}
if (in_array(substr(php_sapi_name(), 0, 3), array('cgi', 'fpm')))
{
// remove duplicate headers
$remove = array('status', 'content-type');
// already sent headers
$sent = array();
foreach (headers_list() as $header)
{
// parse name
if (!$pos = strpos($header, ':'))
continue;
$sent[strtolower(substr($header, 0, $pos))] = true;
}
// raw headers
$headersRaw = array();
foreach ($this->_headersRaw as $i=>$header)
{
// parse name
if (!$pos = strpos($header, ':'))
continue;
$name = strtolower(substr($header, 0, $pos));
if (in_array($name, $remove))
{
// check sent headers
if ($sent[$name])
{
unset($this->_headersRaw[$i]);
continue;
}
// check header
if (!is_null($existing = $headers[$name]))
{
$this->_headersRaw[$existing] = $header;
unset($this->_headersRaw[$i]);
}
else
$headersRaw[$name] = $i;
}
}
// object headers
$headers = array();
foreach ($this->_headers as $i=>$header)
{
$name = strtolower($header['name']);
if (in_array($name, $remove))
{
// check sent headers
if ($sent[$name])
{
unset($this->_headers[$i]);
continue;
}
// check header
if (!is_null($existing = $headers[$name]))
{
$this->_headers[$existing] = $header;
unset($this->_headers[$i]);
}
else
$headers[$name] = $i;
// check raw headers
if (!is_null($existing = $headersRaw[$name]))
unset($this->_headersRaw[$existing]);
}
}
}
parent::sendHeaders();
}
Possiamo fare in modo che la larghezza delle celle di un foglio excel si adatti…
Il progetto che prevedeva uno script bash per il monitoraggio, tramite crontab, delle risorse di…
Portare un progetto editoriale sullo smartphone non significa necessariamente riscriverlo da zero. Con RicetteUmbre abbiamo…
Reading Time: 2 minutesMonitorare le risorse di un server o computer linux in modo semplice…
Reading Time: < 1 minuteEsclusione di una serie di prodotti selezionati tramite l'apposito menù e…
Reading Time: < 1 minuteNel video che vedete di seguito, a titolo di esempio, ho…