Page 1 of 1

PHP 7 opencart checkout registration SyntaxError???

Posted: Sun Dec 09, 2018 9:51 am
by korisnik
My opencart 2.3.0.2 site work fine on PHP 5.6, but when try to use PHP 7 on server i have error.
On checkout page if i try registration, i have this error:

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
OK

What can be problem on PHP 7?

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Sun Dec 09, 2018 2:33 pm
by IP_CAM
Did you already change the
system/library/encryption.php file ?
Ernie
viewtopic.php?f=199&t=208476#p740744
viewtopic.php?f=202&t=206794&p=733801#p733629

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Sun Dec 09, 2018 11:28 pm
by korisnik
After sugestion, i tryed plenty encryption.php files, but problem persist.
What is right encryption.php file for opencart 2.3.0.2?

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Mon Dec 10, 2018 11:16 am
by IP_CAM
Well, you probably use some Custom Checkout Routine, otherwise, a
lot of people would already have complaind about this. But, if so, you'll
have to get the Fellow in charge, to make such an extension to work with
PHP-7, which is not the case with some Extensions.
Good Luck!
Ernie

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Mon Dec 10, 2018 5:30 pm
by thekrotek
This is a generic JS error, which means, that bad data is returned, wrong format or something like that. There's no generic solution for this.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Mon Dec 10, 2018 11:29 pm
by korisnik
I really using custom checkout component(my first suspicion), but it is not problem.
For testing i turned off this component - and i have same error on default opencart checkout page.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Tue Dec 11, 2018 12:55 am
by ADD Creative
Check your error logs for any errors that may be related. Both the one in OpenCart and also your servers PHP error_log.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Tue Dec 11, 2018 8:37 am
by korisnik
I have this error in opencart error logs:
PHP Warning: mail() has been disabled for security reasons in /*/*/public_html/system/library/mail.php on line 158

Can it be reason, php mail enabled for PHP 5.6 but disabled for PHP 7?

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Tue Dec 11, 2018 7:21 pm
by ADD Creative
It's something you would have to ask your host about. Or switch to using SMTP.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Wed Dec 12, 2018 8:54 pm
by thekrotek
korisnik wrote:
Tue Dec 11, 2018 8:37 am
Can it be reason, php mail enabled for PHP 5.6 but disabled for PHP 7?
Yes, most likely. Like said above, contact your hosting provider or switch to SMTP.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Wed Dec 12, 2018 10:48 pm
by korisnik
I contacted my hosting, and he ask me to use SMTP.
From begining SMTP not working for me, i have "PHP Warning: fsockopen(): unable to connect to..." error.
I tryed every solution from forum, but SMTP for gmail can't working.

Re: PHP 7 opencart checkout registration SyntaxError???

Posted: Thu Dec 13, 2018 12:35 am
by ADD Creative
Unless you can work out why SMTP isn't working (could be down to your host) or you can get your host the allow mail() on PHP 7, you might have to change host.