您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程
ecshop安装登录常见报错的解决方法
余梦茂2024-12-25Ecshop商城教程已有人查阅
导读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.
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();改成:
解决:查看发现有libjpeg.lib库,GD2库也有,都加载了,也都正常。查看ecshop源代码发现install/includes/lib_installer.php中第100行,JPEG写成了JPG,正确的应该是:
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,在页头使用
一,ECshop是基于PHP5.3以下版本开发的,由于PHP5.5版本已废除了e模式修饰符,因此如果你使用的是PHP5.5以上环境安装,可能会出现类似以下3种报错
PHP 5.5.0 起, 传入 "\e" 修饰符的时候,会产生一个 E_DEPRECATED 错误; PHP 7.0.0 起,会产生 E_WARNING 错误,同时 "\e" 也无法起效。
可以使用 preg_replace_callback() 代替。
1,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 定位至300行,将原本
定位到upload\includes\cls_template.php第555行,将
定位到 upload\includes\cls_template.php on line 1075,将
定位到upload\includes\cls_template.php on line 496
1,Strict standards: Only variables should be passed by reference in /usr/local/httpd2/htdocs/upload/includes/cls_template.php on line 423
定位upload/includes/cls_template.php on line 423:
定位到upload\includes\lib_main.php on line 1329
此报错是使用PHP5.4以上版本安装ecshop可能出现的,例如本人安装后登录管理后台显示不出验证码这个情况:
右键验证码处点击“复制图片网址”后打开,便能看到这个错误。
打开报错所在文件看到如下代码:
四,mktime()问题
1,Strict standards: mktime(): You should be using the time() function instead in F:\php_act\11_ec\upload\admin\sms_url.php on line 31
定位到upload\admin\sms_url.php on line 31
定位到upload\admin\shop_config.php on line 32,修改同上
解决:找到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种报错
PHP 5.5.0 起, 传入 "\e" 修饰符的时候,会产生一个 E_DEPRECATED 错误; PHP 7.0.0 起,会产生 E_WARNING 错误,同时 "\e" 也无法起效。
可以使用 preg_replace_callback() 代替。
1,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 定位至300行,将原本
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
改为
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
2,Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\php_act\11_ec\upload\includes\cls_template.php on line 555定位到upload\includes\cls_template.php第555行,将
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
改为
$val=preg_replace_callback("/\[([^\[\]]*)\]/is",function($r){return '.'.str_replace('$','\$',$r[1]);},$val);
3,Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\php_act\11_ec\upload\includes\cls_template.php on line 1075定位到 upload\includes\cls_template.php on line 1075,将
$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
改为一行
$source = preg_replace_callback('/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s', function($r){return '{include file='.strtolower($r[1]). '}';}, $source);
4,Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in F:\php_act\11_ec\upload\includes\cls_template.php on line 496定位到upload\includes\cls_template.php on line 496
$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
改为
$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($r){return stripslashes(trim($r[1],'\''));}, var_export($t, true)) . ";\n";
二,PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递1,Strict standards: Only variables should be passed by reference in /usr/local/httpd2/htdocs/upload/includes/cls_template.php on line 423
定位upload/includes/cls_template.php on line 423:
$tag_sel = array_shift(explode(' ', $tag));
改为
$tag_sel = explode(' ', $tag);$tag_sel = array_shift($tag_sel);
2,Strict standards: Only variables should be passed by reference in F:\php_act\11_ec\upload\includes\lib_main.php on line 1329定位到upload\includes\lib_main.php on line 1329
$ext = end(explode('.', $tmp));
改为
$_end=explode('.', $tmp);
$ext = end($_end);
三,Strict standards: Redefining already defined constructor for class XXX此报错是使用PHP5.4以上版本安装ecshop可能出现的,例如本人安装后登录管理后台显示不出验证码这个情况:
右键验证码处点击“复制图片网址”后打开,便能看到这个错误。
打开报错所在文件看到如下代码:
function captcha($folder = '', $width = 145, $height = 20)
{
if (!empty($folder))
{
$this->folder = $folder;
}
$this->width = $width;
$this->height = $height;
/* 检查是否支持 GD */
if (PHP_VERSION >= '4.3')
{
return (function_exists('imagecreatetruecolor') || function_exists('imagecreate'));
}
else
{
return (((imagetypes() & IMG_GIF) > 0) || ((imagetypes() & IMG_JPG)) > 0 );
}
}
function __construct($folder = '', $width = 145, $height = 20)
{
$this->captcha($folder, $width, $height);
}
可以看到其中使用和类名相同点函数名作为构造函数是php4时代的写法,php5时代的构造函数是 __construct(),ecshop为了兼容老版本的php,所以采用了上面的写法,但是从php5.4开始,对于这样的两种写法同时出现的情况,要求必须__construct()在前,同名函数在后,所以只需要对调两个函数的位置即可。四,mktime()问题
1,Strict standards: mktime(): You should be using the time() function instead in F:\php_act\11_ec\upload\admin\sms_url.php on line 31
定位到upload\admin\sms_url.php on line 31
$auth = mktime();
改为
$auth = time();
2, Strict standards: mktime(): You should be using the time() function instead in F:\php_act\11_ec\upload\admin\shop_config.php on line 32定位到upload\admin\shop_config.php on line 32,修改同上
本文标签:
很赞哦! ()
相关教程
图文教程
ecshop任何页面调用指定商品分类下面精品商品的实现方法
ECSHOP商城任何页面调用指定商品分类下面精品商品,比如首页,商品页面,分类页面,调用指定商品分类下面的精品商品。
ecshop使用最多的修改
1: 如何修改网站 " 欢迎光临本店 "回答 :languages/zh_cn/common.php 文件中, $_LANG['welcome'] = ' 欢迎光临本店 '; 将他修改成你需要的字样。
ecshop二次开发商品增加新字段的实现方法
ECSHOP二次开发工作之如何给商品增加一个新字段,来录入一些新的内容。 下面我们结合ecshop后台“商品编辑”、“商品录入”来谈谈如何给ecshop商品增加一个新字段,假设我们将
了解ecshop中的aes加密封装
从一家做shopex,ecstore的公司到一家做b2b的ecshop的公司...来了就要实战,其他的不说了,先来了解什么是php的aes加密吧?
相关源码
-
(自适应响应式)高端珠宝首饰奢侈品pbootcms模板下载本模板为珠宝首饰及奢侈品行业打造,采用PbootCMS内核开发,具备卓越的视觉表现力与商业转化能力。自适应设计确保在手机端呈现产品细节,后台数据实时同步,助您高效展示钻石查看源码 -
帝国cms淘宝客京东联盟网站整站源码下载本模板基于帝国CMS内核深度开发,为淘宝客行业量身定制。随着腾讯微信与淘宝生态的互联互通,淘宝客链接现可在微信、QQ等平台直接分享,为推广带来更多便利。模板特别优化了店铺推广功能,有效避免商品下架导致的链接失效问题,同时支持京东联盟等多平台商品推广。查看源码 -
(自适应)包装机贴标机设备网站源码免费下载基于PbootCMS内核开发的响应式企业模板,为包装机械、贴标设备等工业领域打造,通过数字化展示提升企业专业形象。查看源码 -
蓝色工业机械五金设备pbootcms模板源码下载(PC+WAP)为机械制造与五金设备企业设计的响应式网站模板,基于PbootCMS内核开发。采用蓝色工业风格强化行业属性,宽屏布局突出设备细节展示,支持PC与WAP端自适应查看源码 -
(自适应)光伏测试仪器电站运维设备网站源码免费下载本模板为光伏检测设备与电站运维服务企业设计,采用PbootCMS内核开发,具备完整的设备展示、技术文档管理及客户服务功能模块。通过自适应结构与SEO优化框架,有效提升企业在移动端和搜索引擎中的专业形象。查看源码 -
(自适应)五金配件机械加工设备pbootcms模板免费下载这款基于PbootCMS开发的网站模板为五金配件和机械加工行业设计,采用简洁有力的设计风格,突出工业产品的专业性和可靠性。模板结构清晰,功能完善,能够有效展示各类工业产品的技术参数和应用场景。查看源码
| 分享笔记 (共有 篇笔记) |
