`
天梯梦
  • 浏览: 13729843 次
  • 性别: Icon_minigender_2
  • 来自: 洛杉矶
社区版块
存档分类
最新评论

Magento 500 错误 How to Solve Magento 500 Internal Server Errors

 
阅读更多

Many users encounter some weird Magento 500 Internal Server Errors (Error type 500). I will try to list the most common solutions. These errors are not always caused by the same reason. You should try to take a look at your server’s error logs to get some help about this error.

 

You can get additional info about the errors by Turning on Developer Mode. Look in the Magento bootstrap file (index.php), you’ll see lines similar to the following

#Mage::setIsDeveloperMode(true);
#ini_set(‘display_errors’, 1);

 

Uncomment these. In a production system, you’d never want to have your errors display to the browser, but while developing having an errors and warnings thrown immediately in your face is invaluable. This way, you will see the actually problem which lead to the Internal Error Server. In almost cases, the reason is that there is an exception throw after output is sent to browser.

 

Solution #1

This error might be caused because you have not set the correct permissions for the magento folders. To solve this go to File Manager and then change the file permission of index.php file from 664 to 644.  Also change the permissions of downloader/index.php file to 644 as well otherwise when you will try to access System > Magento Connect >Magento Connect Manager (after magento installation) by logging to magento admin,  you will get 500 Internal Server Error.

 

You can also try this tool, it’s a magento cleanup utility. It will set the correct permissions for your complete magento installation:

 

  1. Download it
  2. Unzip magento-cleanup.php to the root directory of your magento installation
  3. Browse to http://yourdomain.com/magento/magento-cleanup.php
<?php

## Function to set file permissions to 0644 and folder permissions to 0755

function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
   $d = new RecursiveDirectoryIterator( $dir );
   foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
      if( $path->isDir() ) chmod( $path, $dirModes );
      else if( is_file( $path ) ) chmod( $path, $fileModes );
  }
}

## Function to clean out the contents of specified directory

function cleandir($dir) {

    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {
                if (unlink($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }
            }
            else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {
                cleandir($dir.'/'.$file);
                if (rmdir($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }
            }
        }
        closedir($handle);
    }

}

function isDirEmpty($dir){
     return (($files = @scandir($dir)) && count($files) <= 2);
}

echo "----------------------- CLEANUP START -------------------------<br/>";
$start = (float) array_sum(explode(' ',microtime()));
echo "<br/>*************** SETTING PERMISSIONS ***************<br/>";
echo "Setting all folder permissions to 755<br/>";
echo "Setting all file permissions to 644<br/>";
AllDirChmod( "." );
echo "Setting pear permissions to 550<br/>";
chmod("pear", 550);

echo "<br/>****************** CLEARING CACHE ******************<br/>";

if (file_exists("var/cache")) {
    echo "Clearing var/cache<br/>";
    cleandir("var/cache");
}

if (file_exists("var/session")) {
    echo "Clearing var/session<br/>";
    cleandir("var/session");
}

if (file_exists("var/minifycache")) {
    echo "Clearing var/minifycache<br/>";
    cleandir("var/minifycache");
}

if (file_exists("downloader/pearlib/cache")) {
    echo "Clearing downloader/pearlib/cache<br/>";
    cleandir("downloader/pearlib/cache");
}

if (file_exists("downloader/pearlib/download")) {
    echo "Clearing downloader/pearlib/download<br/>";
    cleandir("downloader/pearlib/download");
}

if (file_exists("downloader/pearlib/pear.ini")) {
    echo "Removing downloader/pearlib/pear.ini<br/>";
    unlink ("downloader/pearlib/pear.ini");
}

echo "<br/>************** CHECKING FOR EXTENSIONS ***********<br/>";
If (!isDirEmpty("app/code/local/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder<br/>";
}
If (!isDirEmpty("app/code/community/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder<br/>";
}
$end = (float) array_sum(explode(' ',microtime()));
echo "<br/>------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------<br/>";
?>

 

Solution #2

Your server does not support some of the magento specifications. You can easily test this using the magento check utility. Follow the steps below to check your server’s software, if there is an incompatibility this utility will show it.

 

  1. Download it
  2. Unzip magento-check.php to the root directory of your magento installation
  3. Browse to http://yourdomain.com/magento/magento-check.php
<?
extension_check(array( 
	'curl',
	'dom', 
	'gd', 
	'hash',
	'iconv',
	'mcrypt',
	'pcre', 
	'pdo', 
	'pdo_mysql', 
	'simplexml'
));

function extension_check($extensions) {
	$fail = '';
	$pass = '';
	
	if(version_compare(phpversion(), '5.2.0', '<')) {
		$fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater)</li>';
	}
	else {
		$pass .='<li>You have<strong> PHP 5.2.0</strong> (or greater)</li>';
	}

	if(!ini_get('safe_mode')) {
		$pass .='<li>Safe Mode is <strong>off</strong></li>';
		preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
		
		if(version_compare($version[0], '4.1.20', '<')) {
			$fail .= '<li>You need<strong> MySQL 4.1.20</strong> (or greater)</li>';
		}
		else {
			$pass .='<li>You have<strong> MySQL 4.1.20</strong> (or greater)</li>';
		}
	}
	else { $fail .= '<li>Safe Mode is <strong>on</strong></li>';  }

	foreach($extensions as $extension) {
		if(!extension_loaded($extension)) {
			$fail .= '<li> You are missing the <strong>'.$extension.'</strong> extension</li>';
		}
		else{	$pass .= '<li>You have the <strong>'.$extension.'</strong> extension</li>';
		}
	}
	
	if($fail) {
		echo '<p><strong>Your server does not meet the following requirements in order to install Magento.</strong>';
		echo '<br>The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:';
		echo '<ul>'.$fail.'</ul></p>';
		echo 'The following requirements were successfully met:';
		echo '<ul>'.$pass.'</ul>';
	} else {
		echo '<p><strong>Congratulations!</strong> Your server meets the requirements for Magento.</p>';
		echo '<ul>'.$pass.'</ul>';

	}
}
?>

 

Solution #3

If you are getting weird 500 internal server errors on specific pages of your site, it might be a matter of resources. I was getting internal server erros on some product pages and on the http://yourdomain.com/checkout/onepage. I found out that the .htacess file of my magento installation was somehow reset and the php_value memory_limit value was set to 32M as soon as I raised it, the internal server errors vanished! You should use at least 256M for over 600-700 SKUs. Magento is very resource hungry and it is easy to get these kind of errors if you try to save some bucks from the hosting.

 

Solution #4

Htaccess file which is located at Magento root folder. It will be this case if you meet Internal Server Error on every page. Try to remove it for testing purpose
If your website was running file for a long time, then it must be a change at Server side, just submit a ticket to Hosting Company.

 

Solution #5 (Comment from Huberto)

If the curl extension is missing you can get 500 Internal server error. You can install it using the command below:

apt-get install curl libcurl3 libcurl3-dev php5-curl

 

from: http://www.techjam.gr/2012/magento/solve-magento-500-internal-server-errors/

 

分享到:
评论

相关推荐

    magento安装错误解决

    ### Magento安装错误解决方案 在初次尝试安装Magento时,可能会遇到一系列技术问题,这些问题往往与服务器配置、PHP扩展、权限设置等密切相关。以下是一些常见问题及其解决方案。 #### 1. PHP Extension "curl" 和...

    magento 500元购买的模板

    你提到的"magento 500元购买的模板"可能是一个专业设计的Magento主题,旨在提升网站的视觉吸引力和用户体验。 在电子商务领域,模板是至关重要的,它们不仅定义了网站的外观,还影响着用户的购物体验。一个好的...

    The Definitive Guide to Magento.pdf

    ### Magento 全面指南知识点概览 #### 一、引言 《Magento全面指南》是电子商务平台Magento的权威参考书籍,由Adam McCombs与Robert Banh共同编写。本书不仅适用于初学者,对于有一定经验的开发者和技术人员也同样...

    Magento 2 Cookbook

    Chapter 2, Magento 2 System Tools, explains how to install Magento 2 via the command shell. Magento released a new powerful tool to manage and install sample data, reindex your database, back up your ...

    The Definitive Guide to Magento (Apress出品 Magento权威指南)

    ### Magento权威指南 #### 书籍概述 《Magento权威指南》是由Adam McCombs与Robert Banh共同编著的一本深入探讨Magento电商平台的技术手册。该书由Apress出版社于2009年出版发行,旨在为读者提供一个全面、系统的...

    magento快速复制网站_magento_magento快速复制站_

    这里,`/path/to/source/magento/`是源站点的Magento根目录,`/path/to/destination/`是目标服务器的目录。 在新服务器上安装MySQL,并导入先前备份的数据库: ```bash mysql -u [new_username] -p[new_password] ...

    Magento2 CookBook

    Chapter 2, Magento 2 System Tools, explains how to install Magento 2 via the command shell. Magento released a new powerful tool to manage and install sample data, reindex your database, back up your ...

    magento500买的模板免费下载

    标题中的“magento500买的模板免费下载”可能指的是一个特定的Magento主题或模板,这个模板原本可能需要花费500元购买,但现在可以免费下载。描述中的内容与标题相呼应,确认了这是一个关于获取Magento模板的资源。 ...

    Magento 2 Beginners Guide

    You’ll start by getting a general understanding of what Magento is, why and how you should use it, and whether it is possible and feasible to migrate from an old web store to Magento 2. As you work ...

    magento二次开发大全

    尽管存在错误,但它们是你提升Magento开发技能的宝贵资源。通过不断学习和实践,你可以逐步成为一个熟练的Magento开发者,能够自如地进行二次开发,满足各种商业需求。记得在社区中分享你的发现和改进,共同促进...

    Magento-SMTP-Email

    Magento是开源的电子商务平台,广泛用于在线商店的建设。SMTP(Simple Mail Transfer Protocol)是用于发送电子邮件的标准协议。在Magento中,SMTP插件扮演着关键角色,它允许商家通过更安全、可靠的SMTP服务器发送...

    magento-java-master.zip_magento

    这个“magento-java-master.zip_magento”压缩包可能是为了提供一个Java连接Magento源码的示例或者库,帮助开发者实现Java与Magento系统的交互。 在Java中与Magento进行交互通常涉及到以下几个关键知识点: 1. **...

    magento数据结构分析

    标题:“Magento数据结构分析” 描述:“Magento数据字典”提供了对Magento系统中各种数据库表的深入理解,这对于理解和优化Magento的性能至关重要。 一、Magento数据结构解析 Magento是一款功能强大的电子商务...

    magento入门学习资料

    Magento是一款强大的开源电子商务平台,以其高度可定制性和灵活性著称。作为一款基于PHP开发的系统,它为商家提供了丰富的功能,包括商品管理、订单处理、客户管理、营销工具等。以下将详细介绍`magento入门学习资料...

    magento图片延时加载插件

    Magento是一款强大的开源电子商务平台,它的灵活性和可扩展性使得开发者能够根据需求定制各种功能。在电商网站中,图片是至关重要的元素,它们可以展示产品细节,吸引顾客注意力。然而,大量的图片也会对网站性能...

    Magento 常用方法和插件

    此外,IDE(如PHPStorm)的Magento插件可以帮助开发者进行代码智能提示和错误检查。 总的来说,熟悉Magento的常用方法和插件,不仅包括对核心框架的理解,还要掌握模块化开发、事件驱动、布局和模板引擎的使用,...

    Magento插件开发手册 Magento Extension Developers Guide

    Magento是一款强大的开源电子商务平台,为开发者提供了广泛的定制和扩展能力。《Magento插件开发手册》是一份详尽的指南,旨在帮助开发者理解Magento的核心架构、编码标准以及如何创建和部署自定义插件。 ### ...

    magento2 developers cookbook

    根据给定文件信息,以下为《Magento 2 Developer's Cookbook》一书中的知识点介绍。 首先,《Magento 2 Developer's Cookbook》是一本针对Magento 2开发的指导手册,它向开发者提供了实用的食谱来解决在Magento 2...

    magento商城数据库

    Magento 商城数据库是一个关键组成部分,它是 Magento 电子商务平台的核心,负责存储所有商品信息、客户数据、订单记录以及网站配置等重要信息。Magento 是一个开源的电子商务解决方案,以其强大的功能和高度可定制...

Global site tag (gtag.js) - Google Analytics