Table of Contents
ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7
您可能感兴趣的文章:
Home php教程 php手册 ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7

ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7

Jun 13, 2016 am 08:46 AM
ecshop php7 php programmer compatible migrate

ECshop 迁移到 PHP7版本时遇到的兼容性问题,ecshopphp7

在 PHP7 上安装 ECShop V2.7.3时,报错!

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ECS has a deprecated constructor in /usr/local/nginx/html/ecshop/upload/includes/cls_ecshop.php on line 25

 

这个报错的原因是 PHP7 不再支持与类名相同的构造方法,构造方法统一使用 __construct(), 比如下面的写法 PHP7 就会报这个错误。

<&#63;php 
class foo { 
function foo() {
echo 'I am the constructor';
}
}
&#63;>
Copy after login

回到 ecshop 我们看一下 cls_ecshop.php 文件的25行。如下


果然有与类名相同的构造方法,我们将构造方法 ECS 修改为 __construct,


回到 ecshop 的安装首页刷新,发现已经没有错误了。


单击下一步,报错

Deprecated: Non-static method cls_image::gd_version() should not be called statically in /usr/local/nginx/html/ecshop/upload/install/includes/lib_installer.php on line 31

这个报错的原因是静态调用非静态方法,比如下面的代码就会报这个错误

<&#63;php 
class foo { 
function bar() {
echo 'I am not static!';
}
}
foo::bar(); 
&#63;>
Copy after login

修改方法也很简单,要么将该方法改为静态方法,要么将该调用改为非静态调用。 我们看一下报错的文件 lib_installer.php 的 31行代码

 

还有cls image类文件的 gd version() 方法,可以看到的确没有使用 static关键字

 

第一种修改方式,将该方法修改为静态方法,在方法前加关键字 public static

 

第二种修改方式,采用非静态方式的调用,修改lib_installer.php 的 31行代码

 

这两种方法都可以解决问题。 回到ecshop的安装步骤第二页,错误提示已经不见了。

 

再下一步悲剧了,PHP7 不支持原始的 mysql api 了,PHP7 支持更好的 Mysqli API 和 pdo_mysql api 所以 ecshop 不改掉操作 mysql 的 api 是无法在 PHP7 上运行起来了。

 

OneAPM for PHP 能够深入到所有 PHP 应用内部完成应用性能管理 能够深入到所有 PHP 应用内部完成应用性能管理和监控,包括代码级别性能问题的可见性、性能瓶颈的快速识别与追溯、真实用户体验监控、服务器监控和端到端的应用性能管理。

以上所述给大家分享了ECshop 迁移到 PHP7版本时遇到的兼容性问题,希望对大家有所帮助。

您可能感兴趣的文章:

  • PHP扩展迁移为PHP7扩展兼容性问题记录
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to migrate WeChat chat history to a new phone How to migrate WeChat chat history to a new phone Mar 26, 2024 pm 04:48 PM

1. Open the WeChat app on the old device, click [Me] in the lower right corner, select the [Settings] function, and click [Chat]. 2. Select [Chat History Migration and Backup], click [Migrate], and select the platform to which you want to migrate the device. 3. Click [Select chats to be migrated], click [Select all] in the lower left corner, or select chat records yourself. 4. After selecting, click [Start] in the lower right corner to log in to this WeChat account using the new device. 5. Then scan the QR code to start migrating chat records. Users only need to wait for the migration to complete.

Linux and Docker: How to migrate and synchronize containers across hosts? Linux and Docker: How to migrate and synchronize containers across hosts? Jul 29, 2023 pm 02:52 PM

Linux and Docker: How to migrate and synchronize containers across hosts? Summary: Docker is a popular containerization technology that provides a lightweight virtualization solution. In a multi-host environment, it is a very common requirement to migrate and synchronize containers across hosts. This article will introduce how to use Linux and Docker to implement cross-host migration and synchronization of containers, and provide some sample code for reference. Introduction The rise of containerization technology makes application deployment and migration more flexible and efficient. on multiple hosts

The most stable version of Win10 The most stable version of Win10 Dec 25, 2023 pm 07:58 PM

Many users will encounter freezes or blue screens when operating the computer. At this time, we need to find the most stable win10 version to operate. Overall, it is very easy to use and can make your daily use smoother. The most stable win10 version in history 1. Win10 genuine original system. Here users can use simple operations. The system has been optimized and has strong stability, security and compatibility. Users can follow the steps to achieve the perfect machine. 2. Russian master streamlined The version of win10 has been strictly streamlined and many unnecessary functions and services have been deleted. After streamlining, the system has lower CPU and memory usage and runs faster. 3. Win10 Lite Edition 1909 is installed on multiple computers with different hardware models.

How to migrate and integrate projects in GitLab How to migrate and integrate projects in GitLab Oct 27, 2023 pm 05:53 PM

How to migrate and integrate projects in GitLab Introduction: In the software development process, project migration and integration is an important task. As a popular code hosting platform, GitLab provides a series of convenient tools and functions to support project migration and integration. This article will introduce the specific steps for project migration and integration in GitLab, and provide some code examples to help readers better understand. 1. Project migration Project migration is to migrate the existing code base from a source code management system to GitLab

What should I do if the plug-in is installed in php7.0 but it still shows that it is not installed? What should I do if the plug-in is installed in php7.0 but it still shows that it is not installed? Apr 02, 2024 pm 07:39 PM

To resolve the plugin not showing installed issue in PHP 7.0: Check the plugin configuration and enable the plugin. Restart PHP to apply configuration changes. Check the plugin file permissions to make sure they are correct. Install missing dependencies to ensure the plugin functions properly. If all other steps fail, rebuild PHP. Other possible causes include incompatible plugin versions, loading the wrong version, or PHP configuration issues.

How to transfer WeChat chat history to another mobile phone How to transfer WeChat chat history to another mobile phone May 08, 2024 am 11:20 AM

1. On the old device, click "Me" → "Settings" → "Chat" → "Chat History Migration and Backup" → "Migrate". 2. Select the target platform device to be migrated, select the chat records to be migrated, and click "Start". 3. Log in with the same WeChat account on the new device and scan the QR code to start chat record migration.

Cloud Modernization with C++: Migrating Legacy Applications to the Cloud Cloud Modernization with C++: Migrating Legacy Applications to the Cloud Jun 01, 2024 am 09:21 AM

The best way to move legacy C++ applications to the cloud: Re-platform: Move the application code to a cloud-native platform (such as Kubernetes) and leverage cloud services. Cloudization: Deploy applications on cloud platforms and utilize cloud services without code refactoring.

How to transfer WeChat chat history to another phone How to transfer WeChat chat history to another phone Mar 26, 2024 pm 04:50 PM

By opening WeChat on the old device, selecting &quot;Chat History Migration and Backup&quot; and following the prompts, users can migrate their chat history to the new device. The migration process involves selecting the chats that need to be migrated, scanning the QR code and waiting for the migration to complete.

See all articles