Post by wgidivision » Wed Oct 10, 2018 12:35 am

I re-installed opencart 3.X on a cent os 7 box and cannot restore from the .sql file. I am getting the following message...

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

OK

<b>Warning</b>: Division by zero in <b>/var/www/html/JaxOrdering/admin/controller/tool/backup.php</b> on line <b>115</b>{"total":0,"next":"http:\/\/www.blackjaxamity.net\/admin\/index.php?route=tool\/backup\/import&user_token=v0vbdLMJ9ZUPcS10uxeyd395NvUp5YUs&import=\/var\/www\/html\/storage\/upload\/bac9FqZDb&position=8714"}



I have reinstalled the software before with no errors, but every time I reinstall now I am getting this error straight from the get go. I have even made a backup immediately after install, and get the same message after trying to restore. Would there be another place that a reference file may be corrupted that I should re-install? Maybe a DB Problem? Any help would be much appreciated.

Newbie

Posts

Joined
Wed Oct 10, 2018 12:30 am

Post by ADD Creative » Wed Oct 10, 2018 3:21 am

Assuming your version is 3.0.2.0. The lines geberating the error are https://github.com/opencart/opencart/bl ... #L111-L115. To get the Division by zero warning $size must be 0. Which suggests the file is not being uploaded and moved correctly (unlikely as position is not 0) or is getting removed or truncated during the restore process.

Do you see any other errors in the error log? You could try using your web browsers network inspect tool (usually F12) to get a better idea of what's happening and when.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by wgidivision » Wed Oct 10, 2018 3:52 am

Thank you for a quick response. The following are the steps of the last install and since this post just for the sake of alignment of where I'm at in the process...

1. Download version 3.0.2.0 directly on the server to the root folder.
2. Unzip the folder
3. Change permissions on folder recursively
4. Change the config-dist files to config
5. Install
6. Move storage outside the root folder "Automatically"
7. Change permissions on folder recursively
8. Back up .sql
9. restore from that .sql
Error is produced...

the only errors in the log are...
2018-10-09 15:38:17 - PHP Warning: Division by zero in /var/www/html/JaxOrdering/admin/controller/tool/backup.php on line 115
2018-10-09 16:11:34 - PHP Warning: Division by zero in /var/www/html/JaxOrdering/admin/controller/tool/backup.php on line 115

I did have an opencart partner do some custom development of modules on a prior install which is what led me back to doing the backup.

Newbie

Posts

Joined
Wed Oct 10, 2018 12:30 am

Post by IP_CAM » Wed Oct 10, 2018 7:11 am

4. Change the config-dist files to config
should be:
4. Change the config-dist files to config.php
Ernie

For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

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

Post by ADD Creative » Wed Oct 10, 2018 7:49 am

I've done a similar test using a virtually clean install of version 3.0.2.0, with no issues. This leads me to believe it something to do with your hosting. What permissions are you setting? Do you see bac file in your storage/upload directory while uploading. Have you looked at your browsers network inspect tool (usually F12)? You should see a POST to index.php?route=tool/backup/import with the file then lots of GETs to the same URL with the import set to the bac filename with the position being incremented each time.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Wed Oct 10, 2018 5:55 pm

wgidivision wrote:
Wed Oct 10, 2018 12:35 am
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Why not restore the db through phpMyAdmin?

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by wgidivision » Wed Oct 10, 2018 10:12 pm

Thank you Add Creative. I have done multiple clean installs of the Opencart v3.0.2.0 and never had this problem. I do own the server and it sits very close to me. Interestingly, I have multiple Opencart 3.0.2.0 instances on the same computer that I have installed for future projects, but never used. I cannot restore any of those now either.

I did have an opencart developer on the server, in the web directory with proper permissions, fixing their ocmod files to work with others. I also had a custom ocmod made and installed which would not work properly with any of the other ocmods which is what led me to restore in the first place. I was not sure if any site files were changed, and I did not want the site to be modified other than through proper extension development. At this point the restore did not work which is how I ended up back to a fresh install. Still doesn't work.

As for permissions: I am setting them to 777 at this point both in the root folder as well as the storage folder outside the web root. I do see bac... files in the storage/upload folder that have been created. I have used the network inspect tool as well with the following result (see Attached).

Thank you for all your help with this. I am a novice in the realm of opencart/php/Json,linux, but have made a living with sql/vb/.net, windows, so I apologize if I'm not answering the questions accurately. Any other Help or direction is greatly appreciated.

Attachments

Parm-Debug.jpg

Parm-Debug.jpg (294.01 KiB) Viewed 130 times


Newbie

Posts

Joined
Wed Oct 10, 2018 12:30 am

Post by wgidivision » Wed Oct 10, 2018 10:17 pm

Hi paulfeakins,

That's a great thought. Do you know if it will have any other affect on the site. I would like to find the root problem so all the tools work as they should.

Thanks,
Dave
WGIDivision

Newbie

Posts

Joined
Wed Oct 10, 2018 12:30 am

Post by ADD Creative » Thu Oct 11, 2018 7:15 pm

Just a note on permissions the recommended for hosting are usually 755 for directories and 644 for files.

Can you compare one of the bac files to the original file you are up loading, are they the same ? If they are being remove before your can compare them you could temporally comment out the line the that deletes the uploaded file. https://github.com/opencart/opencart/bl ... p.php#L124

If they are the same you know the file upload is working and the problem is more likely a permission, owner or PHP setting issue.

Have you tried not moving the storage directory and leaving under the OpenCart system directory (just temporally)?

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by wgidivision » Thu Oct 11, 2018 10:32 pm

Thanks for the update. The permissions I changed to 777 hoping that would fix the problem. I will change them when I get back to production. I will check the bac files to see if they are the same. I have tried leaving the storage folder in the original location, but I still get the same result.

How does the backup react if the database is recreated? Will that cause an issue? I.E. drop database, recreate then upload sql file?

Newbie

Posts

Joined
Wed Oct 10, 2018 12:30 am

Post by ADD Creative » Thu Oct 11, 2018 11:02 pm

As long as the it has the same tables and columns as the one backed up, I can't see that would be a problem.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 18 guests