Luis Valencia
Luis Valencia

Reputation: 33978

Premature end of script headers index.php

I am having a weird issue very difficult to reproduce.

When I browse to my site , in google chrome, it shows me 500 internal server error. However if I clear browser cookies, history and cache, then it works again fine, after a few moments it starts failing again. It never fails on IE or firefox

The error log, I have this:

Premature end of script headers index.php

my index.php has this:

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

if (version_compare(phpversion(), '5.2.0','<')===true) {
    echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}

$mageFilename = '/home/xx/public_html/app/Mage.php';

if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

#Mage::setIsDeveloperMode(true);

#ini_set('display_errors', 1);

umask(0);

Mage::run('xx','website');

Upvotes: 0

Views: 12021

Answers (3)

syed kamran raza
syed kamran raza

Reputation: 42

Have you checked your file permissions? A lot of the times I see premature end errors it's due to incorrect permissions.

Sometimes it can also be due to leftover options from a recent PHP upgrade/downgrade as well. For this you can check by running php -v and search for anything that references a different version than you have installed (7.0.4).

Upvotes: 0

MyBoon
MyBoon

Reputation: 1298

As you know, php is in the server side. So I don't think that the problem is only on Chrome. I think the problem is located on the .htaccess or in file permissions.

Try to remove the .htaccess (for a test) or place a CHMOD 644 on files and CHMOD 755 on directories.

Upvotes: 1

Rush
Rush

Reputation: 715

umask(0);

umask used in PHP for Set the file Permission remove umask(0) and try that!

Upvotes: 0

Related Questions