Compatibility issues when ECshop is migrated to php 7 _ php instance

Source: Internet
Author: User
Recently, some netizens asked me if I had reported an error when installing ecshopv2.7.3 on php7. I have not found the cause for a long time, the following is an error reported when ECShop V2.7.3 is installed on PHP7!

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/des/cls_ecshop.php on line 25

This error is reported because PHP 7 does not support constructor with the same class name. The constructor uses _ construct () as the constructor. for example, PHP7 will report this error.

<?php class foo { function foo() {echo 'I am the constructor';}}?>

Back to ecshop, let's take a look at the 25 lines of the cls_ecshop.php file. As follows:


Sure enough, there is a constructor with the same class name. we changed the constructor ECS to _ construct,


Go back to the ecshop installation homepage and refresh the page.


Click next to report an error.

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

The error is caused by static call of non-static methods. for example, the following code will report this error.

<?php class foo { function bar() {echo 'I am not static!';}}foo::bar(); ?>

The modification method is also very simple. either change the method to a static method or change the call to a non-static call. Let's take a look at the 31 lines of code in the error file lib_installer.php.


There is also the gd version () method of the cls image file. we can see that the static keyword is not used.


First, modify the method to a static method, and add the keyword public static before the method.


Second, modify the 31 lines of code in lib_installer.php using non-static calls.

Both methods can solve the problem. Go back to the second page of ecshop installation steps, and the error message is no longer displayed.


Another tragedy is that PHP7 does not support the original mysql api. PHP7 supports better Mysqli API and pdo_mysql api. Therefore, ecshop cannot run on PHP7 without changing the mysql api.


OneAPM for PHP can go deep into all PHP applications to complete application performance management. it can go deep into all PHP applications to complete application performance management and monitoring, including visibility of code-level performance problems, fast identification and tracing of performance bottlenecks, Real User Experience Monitoring, server monitoring, and end-to-end application performance management.

The compatibility problems encountered when ECshop is migrated to PHP 7 are shared with you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.