Page 1 of 1

Opencart 2.0.2.0 update to PHP 7.1 or above

Posted: Thu Nov 05, 2020 7:38 pm
by Steve_Regal
Hi,

We have been informed by our server provider (TSOHost) that they are updating their servers on the 4th of December and anything lower than PHP7.1 will no longer be supported.

Using the cPanel multiPHP Manager I have been able to change the PHP from 5.6 to 7.2 on all bar one of my URL subdomains. When I first tried it on PHP7.2 the domain which is a wordpress website works perfectly, but the subdomain which is opencart 2.0.2.0 would not load.

I have set the PHP back to 5.6 and it now has an error : Warning: session_start(): Cannot find save handler 'memcache' - session startup failed in /home/regalautosport/public_html/shop/system/library/session.php on line 12

TSOHost have basically said they do not want to restore from a backup yet as they are not sure why this error has occurred. They have 'hidden' the error so the website can be used by our customers still, but I am unable to login to my admin area and there are no errors showing so I can not troubleshoot anything as I have no idea why it will not login. Obviously hiding the error is not a fix either, and I can not update the PHP as it currently breaks the subdomain.

Any help or thoughts would be greatly appreciated!

Re: Opencart 2.0.2.0 update to PHP 7.1 or above

Posted: Thu Nov 05, 2020 8:17 pm
by ADD Creative
You PHP session handler seems to be 'memcache'. I understand that memcache is not compatible and not included in PHP 7.

You will need to configure your PHP sessions to use a different handler. https://www.php.net/manual/en/session.c ... ve-handler

Re: Opencart 2.0.2.0 update to PHP 7.1 or above

Posted: Thu Nov 05, 2020 10:07 pm
by IP_CAM
You will also have to replace the system/library/encryption.php
File Content with this one, to make your OC Version work with PHP v.7.x:

Code: Select all

<?php
final class Encryption {
	
	private $cipher = 'aes-256-ctr';
	private $digest = 'sha256';
	private $key;
	
	public function __construct($key) {
		$this->key = $key;
	}

	public function encrypt($value) {
		$key       = openssl_digest($this->key, $this->digest, true);
		$iv_length = openssl_cipher_iv_length($this->cipher);
		$iv        = openssl_random_pseudo_bytes($iv_length);
		return base64_encode($iv . openssl_encrypt($value, $this->cipher, $key, OPENSSL_RAW_DATA, $iv));
	}
	
	public function decrypt($value) {
		$key       = openssl_digest($this->key, $this->digest, true);
		$iv_length = openssl_cipher_iv_length($this->cipher);
		$value     = base64_decode($value);
		$iv        = substr($value, 0, $iv_length);
		$value     = substr($value, $iv_length);
		return openssl_decrypt($value, $this->cipher, $key, OPENSSL_RAW_DATA, $iv);
	}
}

Re: Opencart 2.0.2.0 update to PHP 7.1 or above

Posted: Thu Nov 05, 2020 10:34 pm
by Steve_Regal
Thanks, however this did not work, it allowed the site to load which is progress, however the catalogue and admin pages fail to load. Looks like the issue might be deeper routed!

Re: Opencart 2.0.2.0 update to PHP 7.1 or above

Posted: Thu Nov 05, 2020 11:57 pm
by ADD Creative
Use phpinfo() to see what your session settings are and how they differ from the default.

https://www.php.net/manual/en/session.configuration.php