Ecshop instance of compatibility issues encountered when migrating to PHP7 version _php

Source: Internet
Author: User
Tags deprecated

When installing Ecshop V2.7.3 on PHP7, the error!

Deprecated:methods with the same name as their class won't is 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

The reason for this error is that PHP7 no longer supports the same construction method as the class name, and the construction method uses __construct () uniformly, such as the following PHP7 will report this error.

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

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


Sure enough, we have the same construction method as the class name, and we modify the construction method ECS to __construct,


Back to the Ecshop installation homepage refresh, found that there is no error.


Click Next to Error

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

The reason for this error is static call non-static method, such as the following code will report this error

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

The modification method is also simple, either by changing the method to a static method or by changing the call to a non-static call. Let's take a look at the error file. 31 Lines of code lib_installer.php


There is also the GD version () method of the CLS image class file, which you can see does not use the static keyword


The first way to modify the method to a static method is to add the keyword public static before the method


The second way to modify the lib_installer.php 31 lines of code is to use a non-static call

Both of these methods can solve the problem. Go back to the Ecshop installation step on the second page, the error message is gone.


Next tragedy, PHP7 does not support the original MySQL API, PHP7 support better mysqli API and Pdo_mysql API so ecshop does not change the operation of the MySQL API can not run on the PHP7.


ONEAPM for PHP is able to drill down into all PHP applications within the application can be managed and monitored within all PHP applications, including the visibility of code level performance issues, rapid identification and traceability of performance bottlenecks, real user experience monitoring, Server monitoring and End-to-end application performance management.

The above mentioned to share the Ecshop migration to the PHP7 version of the compatibility problems encountered, I hope to help.

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.