Magento 如何调试空白屏幕
我的 Magento 后端出现错误,导致出现空白屏幕 (WSOD)。我已在管理中将错误设置为打开,但 var/logs/ 中没有创建任何内容。 (我已经检查了该目录的权限,一切都是正确的)。
我还在index.php 中设置了ini_set('display_errors', 1) 并将Magento 设置为开发人员模式。 我还启用了 apache 和 php 错误日志。
但没有记录任何错误?!
有人知道为什么没有显示错误吗?当我迷茫的时候! 谢谢
I have an error in my Magento backend that results in a blank screen (WSOD). I have set errors to on in admin but there is nothing being created in var/logs/. (I have checked permissions for that directory and all is correct).
I have also ini_set('display_errors', 1) in index.php and Magento is set to developer mode.
I have also enabled apache and php error logs.
No errors are being logged though?!
Anyone have a clue as to why errors aren't being shown? As I'm confused!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(18)
这就是我纠正它的方法(希望对你们有帮助):
在你的index.php文件中使用以下代码
在我的情况下,它告诉我 error/503.php 不可用。
3.问题出在我使用的推荐扩展上(http://www. magentocommerce.com/magento-connect/magebuzz-free-testimonial.html)
This is how I got it corrected(Hope will help you guys):
Use the following code in your index.php file
In my case it tolde me that error/503.php was unavailable.
3.The issue was with testimonial extension I used(http://www.magentocommerce.com/magento-connect/magebuzz-free-testimonial.html)
每当这种情况发生时,我首先检查的是 PHP 内存限制。
Magento 用它自己的错误处理程序覆盖正常的错误处理程序,但是当错误为“内存不足”时,自定义处理程序无法运行,因此看不到任何内容。
Whenever this happens the first thing I check is the PHP memory limit.
Magento overrides the normal error handler with it's own, but when the error is "Out of memory" that custom handler cannot run, so nothing is seen.
同样的问题,
我刚刚清除了缓存
,瞧!
我不明白那是什么...
Same problem,
I have just purged cache
Et voila !
I don't understand what it was...
magento 中出现空白页的原因可能有以下几种:
1) 文件或目录权限问题。
如果您要从一台服务器迁移到另一台服务器,请记住为目录和文件授予 755 权限
2) 如果您正在处理 xml 文件,突然页面变成空白。检查您是否没有正确注释代码行。未关闭的注释也会产生问题。
3) 可能由于
memory_limit
分配的内存不足而出现问题。4) 尝试清除 var/cache 文件夹内容
5) 尝试清除 var/session 文件夹内容
6) 如果您的扩展在生产中使用 ioncube 加载程序,那么也在开发服务器上安装 ioncube。(就像扩展软件扩展一样)。尽管您可能有ioncube加载器尝试安装最新版本。因为有时当您更新依赖于ioncube的扩展时,会与旧版本不兼容。
7) 在 php.ini 中设置
short_open_tag = On
。有时开发者会使用标签,如果
short_open_tag
未设置为 on,您可能会遇到页面半扭曲等问题。8) 增加 max_input_vars 和 post_max_size php 的值。当您尝试在税收规则中保存大量税率并获得空白页面时,它会有所帮助。
Following can be the reasons for the blank pages in magento
1) File or Directory permission issues.
If you are migrating from one server to another remember to give 755 permission to the directories and files
2) If you were working on an xml file and suddenly the pages go blank. Check you might not have commented the code lines properly.An unclosed comment will also create the problem.
3) There may be issue because of insufficient memory allocation for
memory_limit
.4) Try clearing the var/cache folder contents
5) Try clearing the var/session folder contents
6) If your extensions use ioncube loader on production then install ion cube on development server also.(Like for extendware extensions).Though you may have ion cube loader try installing the latest version.Because some time when you update the extensions which depends on ion cube there is incompatibility with older versions.
7) Set
short_open_tag = On
in php.ini .Some times developers use<? ?>
tags and if theshort_open_tag
is not set to on you may face problems like half distorted page etc.8) Increase max_input_vars and post_max_size values for php. It helps when you try to save large number of tax rates in a tax rule and get a blank page.
这可能就像模板冲突一样简单。恢复为系统/配置/设计/主题中的默认模板。
This could be as simple as a template conflict. Revert to default template in
System/Configuration/Design/Themes.
我也遇到了同样的问题,但在禁用编译器并再次重新安装扩展后解决了。可以通过system->禁用编译器来完成配置->工具->编译..在这里禁用进程...祝你好运
I too had the same problem, but solved after disabling the compiler and again reinstalling the extension. Disable of the compiler can be done by system-> configration-> tools-> compilation.. Here Disable the process... Good Luck
当您没有加载正确的 php 扩展时也可能会出现这种情况。如果不是内存限制问题,我会仔细检查您的系统上是否加载了所有必需的 php 扩展。
It can also be when you don't have a proper php extension loaded. I would double check that you have all of the required php extensions loaded on your system if it isn't the memory limit issue.
我也面临这个错误。
通过更改 app\code\core\Mage\Adminhtml\Block\Widget\Grid.php 中核心函数 getRowUrl 的内容已修复该错误
核心功能是:
替换为:
了解更多详细信息:
http://bit.ly/iTKcer
尽情享受!!!!!!!!!!!!
I was also facing this error.
The error has been fixed by changing content of core function getRowUrl in app\code\core\Mage\Adminhtml\Block\Widget\Grid.php
The core function is :
Replaced with :
For more detail :
http://bit.ly/iTKcer
Enjoy!!!!!!!!!!!!!
我遇到了同样的问题,重新安装主题后解决了
I had the same problem, it was solved after re-installing my Theme
在将 magento 项目上传到我的网络服务器时,我也遇到了同样的问题,在我的情况下,zip 文件在上传过程中已损坏,并且我的许多 php 文件也已损坏。我已经通过ftp上传了。
我已经找到了解决方案。
如果您要从 Linux 计算机制作 zip 文件,请尝试使用命令行工具(例如:ie;
zip -r my_archive.zip /path/of/files/to/compress/
)
并从 Windows filezilla 客户端上传到您的 Web 服务器。
I have also experienced the same problem when uploading the magento project to my webserver, In my case the zip file is corrupted during the upload process and many of my php files are also damaged. I have uploaded via ftp.
I have found the solution for this.
If you are making the zip file from linux machine, try to use command line tool (For example: ie;
zip -r my_archive.zip /path/of/files/to/compress/
)
and do upload to your web server from windows filezilla client.
刚刚遇到这个问题,花了一整天的时间来解决它。尝试增加
memory_limit
,这对我有用!Just ran into this issue and lost the whole day solving it. Try to increase
memory_limit
, that worked for me!这也可能是由于在调试页面时使用 xDebug 书签造成的。只需停止调试器(删除 cookie),它就会恢复正常。
This may also be caused by using the xDebug bookmarks when debugging the page. Just stop debugger (remove cookie) and it will go back to normal.
正如您所说 - 这个问题有一个独立的答案。
更改主题后我遇到了同样的问题。之前内存设置为1024,所以不是这个问题。缓存已清除,错误日志中没有任何有用的内容。
就我而言,解决方案是不同的 - 旧主题有自定义主页模板...将其切换到标准主题修复了它。
As you said - there is one stand alone answer to this issue.
I had same issue after changing theme. Memory was set to 1024 before, so that's not the problem. Cache was cleared and there was nothing useful in error log.
In my case solution was different - old theme had custom homepage template... Switching it to standard one fixed it.
另一个原因
白屏且没有错误消息的 可能是 APC 缓存。
使用 phpinfo() 来了解您的页面是否使用了它(我们PHP 5.4 + APC 3.1.13 存在问题),如果是这样,看看通过 .htaccess 禁用它时会发生什么
php_flag apc.cache_by_default off
apc_clear_cache();
(没有解决方案,但很高兴看看APC是否是问题所在)如果您有有APC并且它是问题所在,那么您可以
ANOTHER REASON
for a white screen without error messages might be fragmentation of the APC cache.
Use phpinfo() to find out if it is used by your page (we had issues with PHP 5.4 + APC 3.1.13) and if so see what happens when you either
php_flag apc.cache_by_default off
apc_clear_cache();
(no solution but good to see if the APC is the problem)If you do have the APC and it is the problem, then you could
我尝试了所有建议的解决方案,但没有运气。
最后我发现我需要使用管理布局和模板与您需要升级到的新 Magento 版本的皮肤。例如,在我的例子中,它是 1.9.2.4
- 基本上,获取所有文件(从新版本的 app/design/adminhtml/default 中),将它们复制并粘贴到当前站点的 app/design/adminhtml/default 文件夹中替换所有旧文件(如果有)
-- 基本上,获取所有文件(从新版本的 Skin/adminhtml/default 中),将它们复制并粘贴到文件夹 Skin/当前站点的 adminhtml/default 替换所有旧文件(如果有)
当然,请记住在执行此操作之前进行备份。
最好的方法是使用 GIT 或 SVN 等版本控制。
I tried all the suggested solutions but no luck.
Finally I found I need to use admin layout & template & skin from a fresh Magento version that you need to upgrade to. For example in my case it is 1.9.2.4
-- Basically, get all the files (from app/design/adminhtml/default of the fresh version), copy and paste these to the folder app/design/adminhtml/default of the current site to replace all the old files if any
-- Basically, get all the files (from skin/adminhtml/default of the fresh version), copy and paste these to the folder skin/adminhtml/default of the current site to replace all the old files if any
Of course, remember to make backups before doing that.
The best is to use a version control as GIT or SVN.
在我的例子中,index.php 文件的大小为零。我把原来的文件复制回来,结果成功了。
但是,不知道是什么删除了index.php 的内容。
In my case size of the index.php file was zero. I copied the original file back and it worked.
However, no idea about what erased the content of index.php.
我的解决方案:通过系统激活插件 ->配置>高级>先进的
My solution: Activating the plugin via System -> Config > Advanced > Advanced
有时会发生这种情况,因为模板设置中不允许使用符号链接:
高级>开发商>模板设置>允许符号链接
Sometimes this happens because symlinks are not allowed in template settings:
Advanced > Developer > Template Settings > Allow Symlinks