Reindexing error in 1.6 (PHP exception in indexer.php) - mysql

Recently I upgraded from 1.4.2 to 1.6.2. Things actually went fairly smoothly, which was relatively surprising. Until I tried to reindex my store. Using the GUI backend gives me the typical no help "Cannot Initialize the indexer process" message. So I tried running indexer.php from the command line (php shell/indexer.php reindexall) which gives me this error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' in /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
0 /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct('mysql:model=mys...', 'shopchau_stage', 'gr8target', Array)
1 /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
2 /home/shopchau/public_html/stage/lib/Varien/Db/Adapter/Pdo/Mysql.php(300): Zend_Db_Adapter_Pdo_Mysql->_connect()
3 /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
4 /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
5 /home/shopchau/public_html/stage/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
in /home/shopchau/public_html/stage/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 144
Now I've tried the various fixes here: delete the locks, delete cache, fixing file permissions, and running checks to see if my DB is corrupt. Far as I can tell, everything else is working. Nothing so far, has helped this issue.
Anyone have any ideas/fixes?

That exception tells about connection problem. Are you sure MySQL uses /var/lib/mysql/mysql.sock socket? Try changing it to /tmp/mysql.sock. You can adjust this in your local.xml

Related

How do I resolve a backup restoration error

I am trying to reconstruct a website from backups. When I try to import the database content via PHPMyAdmin, I get the following error:
Fatal error: Uncaught TypeError: mb_strcut() expects parameter 1 to be string, bool given in /home/customer/public_html/phpmyadmin/libraries/classes/File.php:772 Stack trace: #0 /home/customer/public_html/phpmyadmin/libraries/classes/File.php(772): mb_strcut(false, 0, 32768) #1 /home/customer/public_html/phpmyadmin/libraries/classes/Import.php(432): PhpMyAdmin\File->read(32768) #2 /home/customer/public_html/phpmyadmin/libraries/classes/Plugins/Import/ImportSql.php(135): PhpMyAdmin\Import->getNextChunk(Object(PhpMyAdmin\File)) #3 /home/customer/public_html/phpmyadmin/libraries/classes/Controllers/ImportController.php(635): PhpMyAdmin\Plugins\Import\ImportSql->doImport(Object(PhpMyAdmin\File), Array) #4 /home/customer/public_html/phpmyadmin/libraries/classes/Routing.php(186): PhpMyAdmin\Controllers\ImportController->index(Array) #5 /home/customer/public_html/phpmyadmin/index.php(18): PhpMyAdmin\Routing::callControllerForRoute('/import', Object(FastRoute\Dispatcher\GroupCountBased), Object(Symfony\Component\DependencyInjecti in /home/customer/public_html/phpmyadmin/libraries/classes/File.php on line 772
I have looked everywhere to try and find how to overcome the problem, but so far, no joy.
Any help more than welcome.
We have tried importing on to two different hosting platforms (Plesk and Siteground's own).
Plesk produced an "unknown" Plesk version error.
Also tried importing a dump and importing directly via PHPMyAdmin. Dump did not recognise the file, PHPMyAdmin produced this error. We also tried to restore the back up without any luck. Finally, we tried to open the mySQL zip file directly but it is password protected.
Note we have no control of the file source, which is the only back up.
Note 2. I get the same import error when I try to import to Xampp local server

Compatible MySQL_connect alternative in PHP 8.1

Have a xamp server running PHP Version 8.1.10. When trying to connect, it gives the following error: Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\elims\databaseConnect.php:7 Stack trace: #0 C:\xampp\htdocs\elims\index.php(7): require_once() #1 {main} thrown in C:\xampp\htdocs\elims\databaseConnect.php on line 7
Commenting out the following lines with # logged me in the main window of the application but failed to connect with the sql batabes:
<?php
$host='localhost';
$username='root';
$password='';
$database='elims';
**#** $connect=mysql_connect($host,$username,$password) or die("databse connection failed...".mysql_error());;
**#** $db_select=mysql_select_db($database,$connect) or die("databse connection failed...".mysql_error());
?>
Do understand mysql_connect is nolonger applicatble in php versions higher than 7, then what works.

Perch CMS isn't connecting to my XAMPP database

I'm just trying to install Perch CMS into my site locally. At setup, I put in my XAMPP database server host name, username and I leave the password blank because that is how it is meant to be. But it shows me this error code when I try to move forward:
Fatal error: Uncaught Error: Undefined constant "PERCH_DB_PASSWORD" in C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php:46 Stack trace: #0 C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php(46): constant('PERCH_DB_PASSWO...') #1 C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php(75): PerchDB_MySQL->config('PERCH_DB_PASSWO...') #2 C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php(117): PerchDB_MySQL->open_link() #3 C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php(460): PerchDB_MySQL->get_link() #4 C:\xampp\htdocs\dschc\cms\setup\PerchSetup_Installation.class.php(13): PerchDB_MySQL->test_connection() #5 C:\xampp\htdocs\dschc\cms\setup\database\index.php(50): PerchSetup_Installation->test_db(Array) #6 {main} thrown in C:\xampp\htdocs\dschc\cms\core\lib\PerchDB_MySQL.class.php on line 46
P.S I have never changed my database connection credentials since I installed XAMPP

MySQL restart causes double free or corruption using MySQL C API

I have a c program that maintains a persistent MySQL connection, version 5.1.46. If I restart mysql while the program is running I get a double free or corruption error as such:
# /etc/init.d/mysql restart
Shutting down MySQL........ [ OK ]
Starting MySQL.*** glibc detected *** /home/user/a.out: double free or corruption (!prev): 0x000000000b64dd00 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3739471634]
I am expecting the connection to automatically reconnect since I have set the MYSQL_OPT_RECONNECT option and have not explicitly closed this connection yet. In addition, the query I am executing is not a char* that I have accidentally set to NULL or deallocated, it is a constant, double quoted string.
Here are a few lines from the resulting core file in gdb
#11 0x000000000044ed71 in mysql_send_query (mysql=0x41966aa0, query=0x41966100 "SELECT count (*) from TableA", length=27) at client.c:2894
#12 0x000000000044edd9 in mysql_real_query (mysql=0x602a, query=0x602d <Address 0x602d out of bounds>, length=6) at client.c:2905
#13 0x000000000042b42f in do_query (conn=0x41966aa0, msg=0x41966100 "SELECT count(*) from TableA") at dosql.cpp:20
Any ideas why this might be occurring?
Any ideas why this might be occurring?
Because of a bug in MySQL.
You can try to update to later package, and see if the problem disappears.
Alternatively, run your client program under Valgrind, and it will report the bug in a way that is usable for fixing it. In particular, it will report
stack trace where the memory was allocated
stack trace where it has been freed
stack trace where double-free is happening (should be same as your GDB stack trace)
Given that info, you could report the bug to MySQL developers, and hope it will eventually be fixed.

Error Database connection with user and password info

I have a connection to a data base and every time there is a problem connecting I get this error.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '205.178.146.104' (4)' in /data/18/2/77/115/2566441/user/2813515/htdocs/ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
#0 .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct('mysql:dbname=si...', 'xxx', 'xxx', Array)
#1 .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Abstract.php(459): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DESCRIBE `user`', Array)
#4 .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Mysq in .../ZendFramework-1.11.5/library/Zend/Db/Adapter/Pdo/Abstract.php on line 144
The thing is that the database user and password are visible on the page in the error message. Is there a way that I can prevent PHP from showing that info? Or is this happening because I am set up a a developing instead of production?
It is a combination of both. In development, your showing your errors. Which is the primary reason your seeing that.
However, you can catch the exception by testing the connection before the query. Allowing you to handle your own connection failures.
try {
Zend_Db_Table::getDefaultAdapter()->getConnection();
} catch (Zend_Exception $e) {
throw new Zend_Exception("A different error");
}
It is because you are on "developing" (exceptions are shown in browser)
Solution 1: Use Production Environment ;)
Solution 2: Change settings in application.ini
Solution 3: Use an try/catch block for database connect