Post by odenor » Thu Nov 22, 2018 10:28 pm

My provider upgraded PHP from 5.6 to 7.2 and my site/shop stopped to work. I tried to start from upgrade of shop and follow with instructions.
But during upgrade came message

SyntaxError: Unexpected token < in JSON at position 0 OK Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /customers/d/e/c/jordalblomster.no/httpd.www/shop1/system/library/db/mysql.php on line 12

In my file mysql.php in mentioned lines I see as below
<?php
namespace DB;
final class MySQL {
private $connection;

public function __construct($hostname, $username, $password, $database, $port = '3306') {
if (!$this->connection = mysqli_connect($hostname . ':' . $port, $username, $password)) {
trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
exit();
}

if (!mysqli_select_db($database, $this->connection)) {
throw new \Exception ('Error: Could not connect to database ' . $database);
}

mysqli_query("SET NAMES 'utf8'", $this->connection);
mysqli_query("SET CHARACTER SET utf8", $this->connection);
mysqli_query("SET CHARACTER_SET_CONNECTION=utf8", $this->connection);
mysqli_query("SET SQL_MODE = ''", $this->connection);

+++++++++++++

What shall I correct?
I already chnaged in words mysql to mysqli
Thanks in advance for help

Newbie

Posts

Joined
Sun Mar 03, 2013 10:52 pm

Post by IP_CAM » Fri Nov 23, 2018 5:53 am

Well, you should better have come herem reading, before trying to do the impossible,
by attempting to UPGRADE something, where absolutely NOTHING of the old Version
Code can be used, not even the Database, as it exists by default. :choke:
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by odenor » Fri Nov 23, 2018 6:28 am

well..what to do in my case?
How to proceed if my proivider changed php to 7,2 and my opencart quite old
With 5.6 version the shoip was working well.. Now not at all.
Do I need to upgrade the shop to 3xxx?
Can I stay with old version of opencart but make it working with new php7,2?

To create the shop again from scratch will be disaster

Newbie

Posts

Joined
Sun Mar 03, 2013 10:52 pm

Post by IP_CAM » Fri Nov 23, 2018 8:07 am

Well, disaster or not, it's one of the reasons, why one should always make sure first.

But I just tested the encryption.php File, placed into an OC v.1.5.3.1 in an
old OC Localhost Environment, by use of this PHP7-compatible
system/library/encryption.php File, and the only Error I got was an email-related
problem, since I have nothing configured, to allow eMails to be sent from this localhost/PC
environment. But otherwise, I found nothing else, keeping the Shop from running, during
my 3 minute test... :D

But I did NOT test it under PHP-7, so, I cannot really tell, if it only requires this File, to
be replaced, or if other matters will keep an 1.5.4 Version from further doing it's Job !

Also make sure, to also have the bcrypt.php file placed in the same Directory
system/library/bcrypt.php, since some functions or Mods might look for it. :D

I also added a few other encryption.php Files into the ZIP, you might need another one,
but so, you at least have some choice .. ::)
---
But possibly, you also use some Extensions/Modules, and some of them might refuse
to further function. Just to have this mentioned too.

Good Luck, that's all I can do for you. ;)
Ernie
---
PS: NOT ALL of those Files have been tested in my Software, so,
better also check around in the OC Forum, to get some comments on
some of them, which I am not able to 'judge' on.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by odenor » Fri Nov 23, 2018 8:44 pm

Thank you very much for advises. Tried all encryption files one by one but none of them working with PHP7.2
As soon as I switch to 5.6 everything OK.
But 5.6 to be removed by my provider on 03 of december...
With 7.2 comming following error.
+++++++++++
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /customers/d/e/c/jordalblomster.no/httpd.www/shop/system/database/mysql.php:11 Stack trace: #0 /customers/d/e/c/jordalblomster.no/httpd.www/shop/system/library/db.php(12): MySQL->__construct('jordalblomster....', 'jordalblomster_', 'Oxxxxxxxxxxxxx...', 'jordalblomster_') #1 /customers/d/e/c/jordalblomster.no/httpd.www/shop/index.php(38): DB->__construct('mysql', 'jordalblomster....', 'jordalblomster_', 'Oxxxxxxxxxxx...', 'jordalblomster_') #2 {main} thrown in /customers/d/e/c/jordalblomster.no/httpd.www/shop/system/database/mysql.php on line 11

+++++++++++++++
( i just retyped my password with xxxx...)

Any advice ? Of course I f I can run 1.5.4 with 7.2 PHP I do not need to upgrade OC and stay with 1.5.4
Will appreciate any help... just few days remain to fix this issue.
Thanks in advance!

Newbie

Posts

Joined
Sun Mar 03, 2013 10:52 pm

Post by IP_CAM » Fri Nov 23, 2018 9:46 pm

Well, MYSQL does no longer function with PHP7, you need to use MYSQLI in any case.
https://www.opencart.com/index.php?rout ... rch=mysqli
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by odenor » Fri Nov 23, 2018 10:50 pm

Dear Ernie, Many thanks!!!!!! Everything OK now and my site/shop back to Normal with PHP 7.2
Very appreciate your attention and proper advice!
Wish you very good day and all the best!
Sergiy
Oslo,Norway

Newbie

Posts

Joined
Sun Mar 03, 2013 10:52 pm

Post by IP_CAM » Sat Nov 24, 2018 8:07 am

Good for you !
Still, you should consider to at least some day move up to the latest
OC v.1.5.x Version, and I will have a 'virgin' OC v.2.0.x Code multi-themed
1.5.6.5(_rc2 :laugh: ) Version ready by the end of November, which could be used,
to test it with existing Themes/Mod's, required to still function as they did
before. Or then, download the official 'stock/default' 1.5.6.5_rc Version,
if your shop already uses a responsive Custom Theme, which you need to
keep.
https://github.com/myopencart/opencart/tree/v1.5.6.x
Then, you only have to download VqMod for OpenCart:
v2.6.1-opencart - anything above is mostly OcMod related/adaption Code
and so possibly only of value by use of PEKU's 1.5.6.5 EDGE as OcMod-Version.
https://github.com/vqmod/vqmod/releases ... 1-opencart
https://github.com/vqmod/vqmod/wiki
to start work! :D
Let me know by PM, if you like to play Tester ...
http://www.gratisangebote.ch
Good Luck !
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by odenor » Mon Nov 26, 2018 4:04 am

Dear Ernie! Yes, can be tester..BUt may be I shall start to create complete new shop based on 3.0.xx?
Only problem as I can see I cannot use template anymore and have to buy new template?
Otherwise I can upgrade as you say to latest 1.5.6 and 2.0?
Or can follow your advice and be your tester

I was playing with my site now and realised SEARCH box not working .When I put anything into search box coming another screen with error...
www.jordalblomster.no is currently unable to handle this request.
HTTP ERROR 500
In error log I see as below
++++++
2018-11-25 20:00:36 - PHP Notice: Undefined variable: languages in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:00:36 - PHP Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:29 - PHP Notice: Undefined variable: languages in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:29 - PHP Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:47 - PHP Notice: Undefined variable: languages in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:47 - PHP Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:49 - PHP Notice: Undefined variable: languages in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52
2018-11-25 20:01:49 - PHP Warning: count(): Parameter must be an array or an object that implements Countable in /customers/d/e/c/jordalblomster.no/httpd.www/shop/catalog/view/theme/OPC020046/template/common/header.tpl on line 52



Rest looks like working well.. including mail system etc.

Is this also related to PHP 7.2?
Thanks and best regards,
Sergiy

Newbie

Posts

Joined
Sun Mar 03, 2013 10:52 pm

Post by IP_CAM » Mon Nov 26, 2018 5:59 am

Well, that's the widespread unfamous PHP-7 Countable Problem,
you could possibly contact the Theme Designer, to get some solution on this,
I am not familiar with this theme.
But If you only use one Language, you could 'Admin-disable' the english Language
to be selectable on the Front Side. And/or manually remove the LANGUAGE related
line/s in the theme header.tpl file as Quick-Fix-Solution for this.

Code: Select all

<?php echo $language; ?>
---
I have made several postings regarding later Versions, and some of them might
no longer exist 8), since not everybody likes that kind of 'publicity'... :laugh:

But generally, there was no V-2 'quasi-final' Version anymore, which could be
taxed as 'TOP V2', since the v.2.3.x is already more a v.3 Prototype than a v 2. ...
In contrary to the 1.5.6.5_rc. And all of those Version Numbers get 'archived'
for good, after a (Sub-) Version Number 'upgrades' :laugh: , and will so remain,
without beeing fixed, even if some misses or faults will be found later on. And
this will force installers, to find out first, and this is not really the most efficient way,
to get something done, as I assume ... :D
In contrary to 1.5.6.5_rc, which is actually nothing, but a 'final-fixed' 1.5.6.4, which
already was a well-done Version, and based on a solid development, as we all know.
It just collided 'time-wise' with the long awaited v.2.x, released a couple of months
earlier, and 1.5.x was therefore no longer of interest to OC itself ... :P
But it's still an official part of the OC Family, just no longer 'shown' in the open: ::)
https://github.com/IP-CAM/Opencart-1.5.6.5_rc
---
So, one better keeps, what is known to function, and some day, OC will have a 'final'
again, or someone will create one, like some Russians are doing it. :D Unfortunately,
they do some things in their own way, don't have all 'default' OC Payments, e.t.c., and
don't translate their Versions in native english either in full, otherwise, one could use
one of them. :'(

But my release will include a couple of nice Themes, so, at least for that one, you won't
have to worry about your existing one. But they don't match your 1.5.4 either, just to
mention this, it's all standard 'OC-2 tech-type' Bootstrap Design, based on famous PEKU's
great "V2Theme to 1.5" Extension Development.
https://www.opencart.com/index.php?rout ... ember=peku
https://github.com/pekka2
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by rossi123 » Sun Dec 09, 2018 2:10 am

IP_CAM wrote:
Fri Nov 23, 2018 5:53 am
Well, you should better have come herem reading, before trying to do the impossible,
by attempting to UPGRADE something, where absolutely NOTHING of the old Version
Code can be used, not even the Database, as it exists by default. :choke:
Ernie
Vielen Dank für die Links, sie sind wirklich hilfreich
Last edited by OSWorX on Sat Mar 07, 2020 12:54 am, edited 1 time in total.
Reason: removed hidden link

Newbie

Posts

Joined
Sun Dec 09, 2018 2:00 am

Post by IP_CAM » Mon Dec 10, 2018 4:34 am

Danke, wobei, eigentlich ist es ja nur noch Zeitverschwendung, mit
dem ständig steigenden Haufen von technischen Doppel-Nullen, und mit
einem Klima, welches sowieso fast nur noch Erkältungen generiert.
Und nicht mal mehr Smilies und Links funzen hier noch seit Neustem, aber
auch Solches passt ja zu Anderen,was länger schon nur noch halbwegs taugt.
Viel Glück !
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by lowe1 » Thu Dec 13, 2018 3:27 am

This thread has been a great help for me and with the use of the encryption files, I have able to get my website to run again. I still have one problem and would really appreciate any help. I can still not access the admin page. I just get a HTTP ERROR 500. My shop is running in version 1.5.6.4 and I am running PHP7.2. I am planning to upgrade my site next year, but right now I need my shop to work.

/Dan

Newbie

Posts

Joined
Mon Dec 07, 2015 5:14 am

Post by IP_CAM » Thu Dec 13, 2018 5:23 am

Well, an Error 500 does not mean anything, it's just a message, that something
went wrong. You therefore have to check in the Server Site Admin Logs, what
kind of error this is. It's possible, that some extension is no longer able to handle
PHP v.7.2x, since, under 'normal' Conditions, the Admin Section should further
function.
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: Amazon [Bot] and 130 guests