Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: New install on localhost has database connection problems  (Read 64036 times)

Offline belleson

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
New install on localhost has database connection problems
« on: May 16, 2016, 11:18:45 PM »
Hi,

I successfully installed Abantecart 1.2.6 on my remote host one week ago and successfully upgraded to 1.2.7 on Saturday. It's a good product.

Changing style (mostly colors) using remote file manager (CPanel) is too difficult so I'm trying to install locally into Windows 7. I upgraded my 5-year-old apache+PHP and installed MySql 5.7, all working well. Then I copied Abantecart 1.2.6 into local site and started install. I had to enable some PHP modules to get all green, then continue to database setup. It gives this error:

-----------------------
Configuration Provide setting below
Error: Could not make a database connection to database mycartdb using myusername@localhost
1 . Please enter your database connection details.
Database Driver: MySQLi *
Database Hostname: localhost *
Database Username: xxx *

-----------------------

If I create a schema using MySql Workbench and do database setup again, it connects and installs for a minute and creates many tables, but finally fails with this error:

-----------------------
Following error has occurred during installation:
OK:
Name    Info
10000::database error
   SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions)' at line 4
Error No: 1064
SQL: SELECT se.`key`, se.`value`, st.store_id FROM settings se RIGHT JOIN stores st ON se.store_id = st.store_id WHERE se.store_id = AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions); in C:\www\public_html\store\core\database\amysqli.php on line 106
-----------------------

Then if I try to login as admin, it gives this error:

-----------------------
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions)' at line 4
Error No: 1064
SQL: SELECT se.`key`, se.`value`, st.store_id FROM settings se RIGHT JOIN stores st ON se.store_id = st.store_id WHERE se.store_id = AND st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions); in C:\www\public_html\store\core\database\amysqli.php on line 106
-----------------------

If I go to storefront, it works ok but there are no data to show because db tables are empty.

I removed MySql and did a full install using Bitnami and it was successful to install Apache+PHP+MySql and AbanteCart 1.2.6 was able to connect to the database ok but the directory structure was not suitable to match my remote setup. So I uninstalled and tried again (2 times) using manual install. It gives the same errors.

Thank you for any help!
« Last Edit: May 16, 2016, 11:22:49 PM by belleson »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5810
  • Karma: +274/-2
    • View Profile
Re: New install on localhost has database connection problems
« Reply #1 on: May 17, 2016, 01:49:31 AM »
Hello

For the localhost there are one click solutions Bitnami stack or Bitnami AbanteCart module for installed XAMPP
https://bitnami.com/stack/abantecart
http://docs.abantecart.com/pages/install/options/localhost_installation.html

Offline belleson

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: New install on localhost has database connection problems
« Reply #2 on: May 17, 2016, 07:08:06 AM »
Thank you for the quick reply. As I said in the original post, I "did a full install using Bitnami and it was successful to install Apache+PHP+MySql and AbanteCart 1.2.6 was able to connect to the database ok but the directory structure [does not] match my remote setup."

Also, I don't want two Apache installs and two PHP installs.

Is there a way to make the manual install connect to the database?

Thanks,
Brian
« Last Edit: May 17, 2016, 07:12:15 AM by belleson »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4359
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: New install on localhost has database connection problems
« Reply #3 on: May 20, 2016, 08:00:05 AM »
Is there a way to make the manual install connect to the database?
Thanks,
Brian

I am not big expert with running Apache and PHP on windows, but I think you should try XAMPP or similar.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5810
  • Karma: +274/-2
    • View Profile
Re: New install on localhost has database connection problems
« Reply #4 on: May 23, 2016, 01:32:18 AM »
...but the directory structure [does not] match my remote setup."
Hello. Only directory where AbanteCart installed should be same

Offline CLT

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: New install on localhost has database connection problems
« Reply #5 on: July 27, 2016, 09:34:09 AM »
Brand new to forum....

I had the same problem...
during the install on my localhost at the point where the demo data is being loaded I got this DB error
================
         Name    Info
        10000::database error
        SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
            near 'AND  st.status = 1 AND se.`group` NOT IN (SELECT `key` FROM extensions)' at line 4
        Error No: 1064
        SQL: SELECT se.`key`, se.`value`, st.store_id FROM settings se RIGHT JOIN stores st ON se.store_id = st.store_id
                    WHERE se.store_id = AND st.status = 1
         AND se.`group` NOT IN (SELECT `key` FROM extensions); in C:\www\public_html\store\core\database\amysqli.php on line 106
================
The SQL issue is in the part of the query
                   **** WHERE se.store_id = AND st.status = 1 ****
there is no value after se.store_id

I debugged the code and not sure where store ID should be properly set but this is where I found / fixed a bug and the install worked for me
===============
/core/lib/config.php around line 230 in method _load_settings()

org code  ( line 230 is last line below and is what I changed)
===========
      if (IS_ADMIN) {
         //Check if admin has specific store in session or selected
         $session = $this->registry->get('session');
         $store_id = $this->registry->get('request')->get['store_id'];
         if (has_value($store_id)) {
             $this->cnfg['current_store_id'] = (int)$store_id;
         } else if(has_value($session->data['current_store_id'])) {
             $this->cnfg['current_store_id'] = $session->data['current_store_id'];   
         } else {
            //nothing to do
             $this->cnfg['current_store_id'] = $session->data['config_store_id'];            


new code
==============
      if (IS_ADMIN) {
         //Check if admin has specific store in session or selected
         $session = $this->registry->get('session');
         $store_id = $this->registry->get('request')->get['store_id'];
         if (has_value($store_id)) {
             $this->cnfg['current_store_id'] = (int)$store_id;
         } else if(has_value($session->data['current_store_id'])) {
             $this->cnfg['current_store_id'] = $session->data['current_store_id'];   
         } else {
            //nothing to do
            // but above test shows this has no value...so assign default of 0
            // install fails
            // CLT 7/27/16
             $this->cnfg['current_store_id'] = 0; // $session->data['config_store_id'];   

=====================
NOTE:  I had to start my install fresh
    delete my DB
    unpack the source again
     make the above code change
before I re-ran the install so the whole install would start over.....but the above change worked for me


Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: New install on localhost has database connection problems
« Reply #6 on: July 27, 2016, 09:58:09 AM »
please replace file core/lib/config.php with this https://github.com/abantecart/abantecart-src/blob/1.2.8/public_html/core/lib/config.php to solve issue.
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

 

Powered by SMFPacks Social Login Mod