ecshop 安装常见的报错

ecshop安装常见报错,以及解决办法:


Ecshop安装过程中的的问题:cls_image::gd_version()和不支持JPEG
  在安装Ecshop的时候,遇到两个问题:

  1.Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\X\www\ecshop\install\includes\lib_installer.PHP on line 31

  解决:找到install/includes/lib_installer.php中的第31行   return cls_image::gd_version();然后在找到include/cls_image.php中的678行,发现gd_version()方法未声明静态static,所以会出错。这时候只要:

  1)将function gd_version()改成static function gd_version()即可。

  2)或者将install/includes/lib_installer.php中的第31行return cls_image::gd_version();改成:

$p = new cls_image();
return $p->gd_version();
  2.检测环境的时候提示:是否支持 JPEG是不支持的。

  解决:查看发现有libjpeg.lib库,GD2库也有,都加载了,也都正常。查看ecshop源代码发现install/includes/lib_installer.php中第100行,JPEG写成了JPG,正确的应该是:

 

$jpeg_enabled = ($gd_info['JPEG Support'] === true) ? $_LANG['support'] : $_LANG['not_support'];
 

  为何说Ecshop写错了,因为我打印数组$gd_info的时候,里面的键名是:JPEG Support。而$gd_info数组里的值都是直接调用系统环境变量的。

 

  3.默认时区问题:Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\X\www\ecshop\install\includes\lib_installer.php on line 225

  解决:方法1,将php.ini里是date.timezone前的";"去掉,改成:date.timezone = PRC;

  方法2,在页头使用 ini_set('date.timezone','Asia/Shanghai');

  方法3,在页头使用date_default_timezone_set()设置 date_default_timezone_set('PRC'); //东八时区 echo date('Y-m-d H:i:s');














ecshop

问题一:商城首页报错 Strict Standards: Only variables should be passed by reference in D:\wamp\ecshop\includes\cls_template.PHP on line 422

解决方法:

找到提示错误的文件 cls_template.php 及行号

把 $tag_sel = array_shift(explode(' ', $tag));

改成:
$tag_arr = explode(' ', $tag); 
$tag_sel = array_shift($tag_arr);

并且删除 D:\wamp\www\ecshop\temp\caches下所有的文件


题二:后台首页报错 Strict Standards: Non-static method cls_image::gd_version() should not be called statically in D:\wamp\www\ecshop\includes\lib_base.php on line 346

解决办法

找到D:\wamp\www\ecshop\includes\cls_image.php文件

搜索 function gd_version 改成 static function gd_version


问题三:后台-商店设置 

Strict Standards: mktime(): You should be using the time() function instead in D:\wamp\www\ecshop\admin\sms_url.php on line 31
Strict Standards: mktime(): You should be using the time() function instead in D:\wamp\www\ecshop\admin\shop_config.php on line 32

解决办法

根据错误提示 把 mktime() 改成 time()

 

问题四:后台-起始页

Strict Standards: Redefining already defined c**tructor for class alipay in D:\www\es\includes\modules\payment\alipay.php on line 85

解决办法

1)、错误原因:
PHP 类,有两种构造函数,一种是跟类同名的函数,一种是 __contruct()。从PHP5.4开始,对这两个函数出现的顺序做了最严格的定义,必须是 __c**truct() 在前,同名函数在后

2)、
解决方法:
调换一下两个函数的前后位置即可。
以 includes/modules/payment/alipay.php  为例:
将下面这两个函数的位置互换一下就OK了,__contruct()在前,alipay()在后

  1.    function alipay()    {
  2.     }

  3.     function __contruct()
  4.     {
  5.         $this->alipay();
  6.     }


3)、ECSHOP的很多类文件 都存在这个问题,都需要修改掉。


问题五:后台-数据备份 

 Strict standards: Redefining already defined constructor for class cls_sql_dump in D:\wamp\www\ecshop\admin\includes\cls_sql_dump.php on line 90
Strict standards: Non-static method cls_sql_dump::get_random_name() should not be called statically in D:\wamp\www\ecshop\admin\database.php on line 64

解决办法

根据错误提示 把 cls_sql_dump的 function __construct()改到  function cls_sql_dump()的前面

把 cls_sql_dump的 function get_random_name()改成 static  function get_random_name()


问题六:

Deprecated: Assigning the return value of new by reference is deprecated in  \admin\sitemap.php on line 46

 $sm     =& new google_sitemap();


解决办法

在5.3版本之后已经不允许在程序中使用”=&”符号。如果你的网站出现了Deprecated: Assigning the return value of new by reference is deprecated in 错误,别着急,先定位到出错的文件,查找下是不是在程序中使用了”=&”,例如刚才定位到网站程序中发现了下图的程序,发现使用了”=&”符号,去掉‘&’符号之后程序运行正常



问题七:

Declaration of phpbb::set_cookie() should be compatible with integrate::set_cookie...

解决办法:把function set_cookie ($username="") 改为function set_cookie ($username="", $remember = NULL)即可


问题八:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in..

解决办法:

我遇见了有两处,都在cls_template.php文件中:

 1、return preg_replace("/{([^\}\{\n]*)}/e", "\$this->sel ect('\\1');", $source);
替换为
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->sel ect($r[1]); }, $source);
问题解决。

2、$val = preg_replace("/

([\[
]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);

  替换为

 $val= preg_replace_callback("/

([\[
]*)\]/eis",function($r){return str_replace('$','\$',$r[1]);}, $val);

问题解决


ECShop安装之后,在后台发现一个错误提示:

Strict Standards: mktime(): You should be using the time() function instead in E:\web\shopex\admin\shop_config.php on line 32

这个错误提示的意思:mktime()方法不带参数被调用时,会被抛出一个报错提示。

找到文件第32行:

$auth = mktime();

将mktime()替换成time()方法,代码为:

$auth = time();




检查代码可以发现,对应的位置是某个类的构造函数,具体写法如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
      * 构造函数
      *
      * @access  public
      * @param
      *
      * @return void
      */
     function alipay()
     {
     }
 
     function __construct()
     {
         $this ->alipay();
     }

其中使用和类名相同点函数名作为构造函数是php4时代的写法,php5时代的构造函数是 __construct(),ecshop为了兼容老版本的php,所以采用了上面的写法。

但是从php5.4开始,对于这样的两种写法同时出现的情况,要求必须__construct()在前,同名函数在后,所以只需要对调两个函数的位置即可。



出现下面这就话:

Strict Standards: Only variables should be passed by reference in E:\Tools\ECShop_V2.7.3_UTF8_release1106\upload\includes\cls_template.php
on line 418
第418行:$tag_sel = array_shift(explode(' ', $tag));
解决办法 1 
5.3以上版本的问题,应该也和配置有关 只要418行把这一句拆成两句就没有问题了  $tag_sel = array_shift(explode(' ', $tag)); 改成: $tag_arr = explode(' ', $tag);  $tag_sel = array_shift($tag_arr);
(实验过,绝对可行) 因为array_shift的参数是引用传递的,5.3以上默认只能传递具体的变量,而不能通过函数返回值 
解决办法 2 : 或则如果这样配置的话: error_reporting = E_ALL | E_STRICT

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值