Page 1 of 2

Updating PHP version would affect the opencart site?

Posted: Fri Nov 24, 2017 1:59 pm
by warisaha
Hello everyone!

I'm using opencart 2.0.3.1 at www.deccan-dental.com and i'm also using wordpress site on the same server with a different directory @ www.deccan-dental.com/newsite.
My problem is i'm getting 500 internal server error after installing a plugin in wordpress site and it is giving me the notice of PHP version update. I would like to ask you that If I update the PHP version from 5.3+ to latest then is there any chance to get my opencart site crashed? Please some one help answering this question. Thanks in advance

Re: Updating PHP version would affect the opencart site?

Posted: Fri Nov 24, 2017 7:41 pm
by kestas
Hi,
Your shop use custom theme and some custom extensions, so you should ask all developers regarding this. Does their extensions support latest php version...

Cheers

Re: Updating PHP version would affect the opencart site?

Posted: Wed Dec 06, 2017 3:42 pm
by warisaha
I contacted all the extension developers and they told that their extensions work as long the Opencart works on the desired PHP version and some one also told that Opencart is safe upto PHP 7.0 and will not compatible with 7.2.

Can anyone suggest me how easily and safely update my PHP version to the latest without being damaged to my website

Thanks in advance

Re: Updating PHP version would affect the opencart site?

Posted: Thu Dec 07, 2017 3:38 am
by IP_CAM
Well, OpenCart v.1.5.6.4+ works up to PHP v.7.2.7 (post updated!) as tested,
and OC v.2 + should work at least up to PHP v.7.1.x. Versions, as they come by default!
Ernie
---
Image

Re: Updating PHP version would affect the opencart site?

Posted: Sat Jan 13, 2018 8:16 am
by windows95
im running an opencart 2.2.0.0 store on PHP version 7.2.1

no issues

Re: Updating PHP version would affect the opencart site?

Posted: Tue Jan 16, 2018 6:28 am
by straightlight
windows95 wrote:
Sat Jan 13, 2018 8:16 am
im running an opencart 2.2.0.0 store on PHP version 7.2.1

no issues
Thanks for the feedback.

Re: Updating PHP version would affect the opencart site?

Posted: Thu Mar 15, 2018 12:21 pm
by David Rahrer
straightlight wrote:
Tue Jan 16, 2018 6:28 am
windows95 wrote:
Sat Jan 13, 2018 8:16 am
im running an opencart 2.2.0.0 store on PHP version 7.2.1

no issues
Thanks for the feedback.
How do you deal with mcrypt being deprecated? I know it has been replaced in the latest version with openssl_encrypt, but I have a store running 2.2.0.0 that has been moved to PHP 7.2.1 and it's having issues with this.

Re: Updating PHP version would affect the opencart site?

Posted: Thu Mar 15, 2018 1:05 pm
by IP_CAM
Well, then just change to a lower v.7.x PHP Version, in any decent Environment,
one should be able to select between different PHP Versions available. And if
not, one just has a poor Hoster.
Ernie

Re: Updating PHP version would affect the opencart site?

Posted: Thu Mar 15, 2018 2:42 pm
by OSWorX
As Ernie said: if you cannot change your php-Version, change the hoster!
If that is no change for you - while I cannot imagine why not, you can contact me to get the solution.

Re: Updating PHP version would affect the opencart site?

Posted: Fri Mar 16, 2018 2:12 am
by David Rahrer
IP_CAM wrote:
Thu Mar 15, 2018 1:05 pm
Well, then just change to a lower v.7.x PHP Version, in any decent Environment,
one should be able to select between different PHP Versions available. And if
not, one just has a poor Hoster.
Ernie
Right, but windows95 said they were running 2.2.0.0 on PHP 7.2.1 as well but with no issues. I was wondering if they had patched the mcrypt issue to make it work.

Re: Updating PHP version would affect the opencart site?

Posted: Fri Mar 16, 2018 2:39 am
by straightlight
system/library/encryption.php did had changes over the years without the need of mcrypt.

Re: Updating PHP version would affect the opencart site?

Posted: Fri May 04, 2018 2:26 pm
by billynoah
Here's a drop in replacement for system/library/encryption.php that will work on OC1.5.6.4 and PHP7.2. Unlike the current version used in OC3, this will not produce the empty iv warning "Warning: openssl_encrypt(): Using an empty Initialization Vector (iv) is potentially insecure and not recommended"

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: Updating PHP version would affect the opencart site?

Posted: Sat May 05, 2018 1:05 am
by IP_CAM
@billynoah:
Well, thanks a million for this piece of Code, it solved a potentially fundamental Problem,
since my 1.5.6.x was not able to pass the PHP 7.0.xx Mark, as it comes. But now, everything
changed, and the future looks bright again, encouraging me to a great extend! :D
It's like getting a late Christmas Gift !!!
Ernie
---
Image

Re: Updating PHP version would affect the opencart site?

Posted: Sat May 05, 2018 1:28 am
by billynoah
Glad I could help Ernie. I originally submitted a variation of this as a rewrite for OC2+ due to the empty IV issue that throws a warning on current PHP versions. The rewritten function uses all modern openssl() functions and there is a pull request in here (https://github.com/opencart/opencart/pull/6326) to have it integrated into the main repository. If you feel it's an improvement, please drop a comment there so we can get this merged.

Re: Updating PHP version would affect the opencart site?

Posted: Mon May 07, 2018 8:02 am
by IP_CAM
Well, I will, since it shows a seemengly widely existing Error on PHP 7.2.x !
Ernie ;)
https://wiki.php.net/rfc/counting_non_countables

Re: Updating PHP version would affect the opencart site?

Posted: Fri Jul 06, 2018 11:23 pm
by sicotommo
Does any one know how to get OC 2.3.0 working on PHP7.2 where mcrypt has been removed? OC 2.3.0 needs mcrypt, is there a workaround similar to the 1.5.6.4 workaround above?

Thanks

Re: Updating PHP version would affect the opencart site?

Posted: Sat Jul 07, 2018 12:23 am
by straightlight
sicotommo wrote:
Fri Jul 06, 2018 11:23 pm
Does any one know how to get OC 2.3.0 working on PHP7.2 where mcrypt has been removed? OC 2.3.0 needs mcrypt, is there a workaround similar to the 1.5.6.4 workaround above?

Thanks
Of course, I have also posted my solution about this sometime ago on the forum and on GitHub: viewtopic.php?f=198&t=204707&p=725370#p725077

Re: Updating PHP version would affect the opencart site?

Posted: Tue Jul 10, 2018 12:28 am
by sicotommo
Thanks!!

Re: Updating PHP version would affect the opencart site?

Posted: Tue Jul 10, 2018 2:01 am
by sicotommo
I installed the script shown above for OC 1.5.6.4 operating on PHP7.2 and still no luck - any suggestions? I also have to do it for OC2.3.0 so will use the appropriate script for that as well.

Thanks for any suggestions

Re: Updating PHP version would affect the opencart site?

Posted: Tue Jul 10, 2018 4:07 am
by straightlight
sicotommo wrote:
Tue Jul 10, 2018 2:01 am
I installed the script shown above for OC 1.5.6.4 operating on PHP7.2 and still no luck - any suggestions? I also have to do it for OC2.3.0 so will use the appropriate script for that as well.

Thanks for any suggestions
At this point, I really wouldn't suggest to v1.5x releases for the latest release of PHP … I would rather suggest at least the use of v2.3.0.2 release of OC. Otherwise, OC v3.x releases.