Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

New install on localhost has database connection problems

Started by belleson, May 16, 2016, 11:18:45 PM

Previous topic - Next topic

belleson

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!

Basara


belleson

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

abantecart

Quote from: belleson on May 17, 2016, 07:08:06 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

Basara

Quote from: belleson on May 17, 2016, 07:08:06 AM
...but the directory structure [does not] match my remote setup."
Hello. Only directory where AbanteCart installed should be same

CLT

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


abolabo

"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

Forum Rules Code of conduct
AbanteCart.com 2010 -