magento 脚本头文件index.php过早结束

vc9ivgsu  于 2022-11-12  发布在  PHP
关注(0)|答案(3)|浏览(133)

我有一个很难重现的奇怪问题。
当我浏览我的网站,在谷歌浏览器,它显示我500内部服务器错误。但是,如果我清除浏览器cookie,历史和缓存,然后它再次工作正常,过了一会儿,它开始再次失败。它从来没有失败的IE或火狐
错误日志中,我有这样一段:
脚本头文件index.php过早结束
我的index.php有这个:

<?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 license@magentocommerce.com 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');
umuewwlo

umuewwlo1#

正如你所知,php是在服务器端,所以我不认为问题只是在Chrome上,我认为问题是在.htaccess或文件权限上。
尝试删除.htaccess(用于测试),或在文件上放置CHMOD 644,在目录上放置CHMOD 755。

t3irkdon

t3irkdon2#

umask(0);

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

xxslljrj3#

你检查过你的文件权限了吗?很多时候我看到过早结束错误,这是由于不正确的权限。
有时候也可能是由于最近PHP升级/降级时遗留的选项。为此,您可以运行php -v进行检查,并搜索任何引用与您安装的版本(7.0.4)不同的版本的内容。

相关问题