QQ 1640076782

2010年04月28日

Zencart外贸建站-调试

Filed under: 外贸PHP — 标签:, , , — lijianbin @ 3:56 下午

Zencart二次开发: 把Zencart程序转到另一服务器后就出现了如下问题:

问题描述:IE浏览器中为空白,Firefox浏览器出现“Content Encoding Error” 谷歌浏览器出现:Error 2 (net::ERR_FAILED): Unknown error.

在网上搜索了大堆的案例,但是很少有这种情况的,官方论坛上出现了两个但是没有给出解决方案,只有一步步的调试

1.先参照网上大部分人提过的,开启错误提示:

在if (defined(‘STRICT_ERROR_REPORTING’) && STRICT_ERROR_REPORTING == true) {

前面加上:defined(‘STRICT_ERROR_REPORTING’,true);

结果:没有任何的反应,错误信息都没有输出

2.设个输入点(var_dump(‘test error’); exit; 在application_top.php中从上到下逐行测试

结果:在require(‘includes/autoload_func.php’);前后有变化,输入点放在此句前能够输出test error,放在后面就又变成和问题描述中一样,由此判断问题出自autoload_func.php文件

3.利用Zenstudio提供的ZendDebugger对autoload_func.php设置断点调试

并在if (DEBUG_AUTOLOAD === true) echo $debugOutput;上面加上var_dump(DEBUG_AUTOLOAD);var_dump($debugOutput);

进入调试模式,一步步的执行,输出信息如下:

X-Powered-By: PHP/5.2.10 ZendServer
Set-Cookie: ZendDebuggerCookie=127.0.0.1%3A10137%3A0||084|77742D65|1000; path=/
Content-type: text/html

bool(false)
string(84) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/class.base.php’);<br />”
bool(false)
string(88) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/class.notifier.php’);<br />”
bool(false)
string(52) “actionPoint=>0 $zco_notifier = new notifier();<br />”
bool(false)
string(89) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/class.phpmailer.php’);<br />”

bool(false)
string(84) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/class.smtp.php’);<br />”
bool(false)
string(79) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/boxes.php’);<br />”
bool(false)
string(87) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/category_tree.php’);<br />”
bool(false)
string(87) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/template_func.php’);<br />”
bool(false)
string(92) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/split_page_results.php’);<br />”
bool(false)
string(82) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/language.php’);<br />”
bool(false)
string(79) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/cache.php’);<br />”
bool(false)
string(81) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/sniffer.php’);<br />”
bool(false)
string(85) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/class.phpbb.php’);<br />”
bool(false)
string(87) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/shopping_cart.php’);<br />”
bool(false)
string(92) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/navigation_history.php’);<br />”
bool(false)
string(84) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/currencies.php’);<br />”
bool(false)
string(87) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/message_stack.php’);<br />”
bool(false)
string(84) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/breadcrumb.php’);<br />”
bool(false)
string(96) “actionPoint=>0 include(‘D:/www/todo-fashion/includes/classes/simple_categories_tree.php’);<br />”

bool(false)
string(79) “actionPoint=>10 include(‘includes/init_includes/init_file_db_names.php’);<br />”
bool(false)
string(74) “actionPoint=>10 include(‘includes/init_includes/init_database.php’);<br />”
bool(false)
string(54) “actionPoint=>20 include(‘includes/version.php’);<br />”
bool(false)
string(46) “actionPoint=>30 $zc_cache = new cache();<br />”
bool(false)
string(80) “actionPoint=>40 include(‘includes/init_includes/init_db_config_read.php’);<br />”
bool(false)
string(47) “actionPoint=>50 $sniffer = new sniffer();<br />”

输入这些之后就报错了,打开includes/auto_loaders/config.core.php文件发现是调用到

$autoLoadConfig[50][] = array(‘autoType’=>’init_script’,
‘loadFile’=> ‘init_gzip.php’);

时出的错。
4.上网搜索了一会发现,这是gzip是对PHP文件进行加速用的,需要在php.ini中配置才行。

打开php.ini,添加下面语句即可为全站的php文件启用gzip加速:
output_buffering = Off
output_handler =
zlib.output_compression = On

重启后发现问题已解决