ecshop安装出现的一些常见的问题

更新时间:2016-07-28 点击量:2164

安装ecshop出现的一些常见的问题:

905655-20160322160425026-528326726.png


优易软件为大家整理,在安装ecshop的时会出现的一些问题解决办法

1.

Strict Standards: Non-static method cls_image::gd_version() should not be called statically in /usr/local/httpd2/htdocs/upload/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 /usr/local/httpd2/htdocs/upload/install/includes/lib_installer.php on line 223


  解决:


  方法1,修改PHP配置文件。如果你服务器的主要时区是亚洲上海,那么修改这里是比较妥当的,当然更稳妥的办法是通过.htaccess导入PHP设置。 

      打开PHP.INI大概在958找到; date.timezone =去掉前面的注释;号,然后改成date.timezone =Asia/Shanghai,保存配置文件,重启你的服务器。


  方法2,在页头使用 

ini_set('date.timezone','Asia/Shanghai');

  方法3,修改\install\includes\lib_installer.php文件。在这个文件顶部<?php之内加上如下PHP代码:

date_default_timezone_set ('Asia/Shanghai');

 


注意!ECshop是基于PHP5.3以下版本开发的,由于PHP5.5版本已废除了e模式修饰符,因此如果你使用的是PHP5.5以上环境安装,可能会出现类似以下3种报错


一,Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /usr/local/httpd2/htdocs/upload/includes/cls_template.php on line 288


 解决方法已经在报错提示中,打开/usr/local/httpd2/htdocs/upload/includes/cls_template.php 定位至288行,将原本


return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);

修改为


return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

即凡有e模式修饰的正则式所在的preg_replace语句,全部改为使用preg_replace_callback方法。


 


二, Strict standards: Only variables should be passed by reference in /usr/local/httpd2/htdocs/upload/includes/cls_template.php on line 406


  打开文件406行发现下面语句:

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

  PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递,因此修改为


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

  即可。


三,Strict standards: Redefining already defined constructor for class XXX


  此报错是使用PHP5.4以上版本安装ecshop可能出现的,例如本人安装后登录管理后台显示不出验证码这个情况:


     905655-20160322200037276-958713480.png 


  右键验证码处点击“复制图片网址”后打开,便能看到这个错误。


  打开报错所在文件看到如下代码:


复制代码

 1     function captcha($folder = '', $width = 145, $height = 20)
 2     {
 3         if (!empty($folder))
 4         {
 5             $this->folder = $folder;
 6         }
 7 
 8         $this->width    = $width;
 9         $this->height   = $height;
10 
11         /* 检查是否支持 GD */
12         if (PHP_VERSION >= '4.3')
13         {
14 
15             return (function_exists('imagecreatetruecolor') || function_exists('imagecreate'));
16         }
17         else
18         {
19 
20             return (((imagetypes() & IMG_GIF) > 0) || ((imagetypes() & IMG_JPG)) > 0 );
21         }
22     }
23 
24  
25     function __construct($folder = '', $width = 145, $height = 20)
26     {
27         $this->captcha($folder, $width, $height);
28     }

复制代码

  可以看到其中使用和类名相同点函数名作为构造函数是php4时代的写法,php5时代的构造函数是 __construct(),ecshop为了兼容老版本的php,所以采用了上面的写法,但是从php5.4开始,对于这样的两种写法同时出现的情况,要求必须__construct()在前,同名函数在后,所以只需要对调两个函数的位置即可。




   


支付宝扫码打赏 微信打赏

如果文章对您有帮助,就打赏一个吧

在线客服

客户服务

热线电话:

13128985956 服务时间:

周一到周六:9:00-18:00

在线QQ客服

在线微信客服

关于我们 常见问题

支付方式 加盟合作

提交需求
优惠红包 购物车0 反馈留言 返回顶部