Compatible MySQL_connect alternative in PHP 8.1 - html

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.

Related

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

Problems with local installation of Magento 1.9.3.8. site

It's my first time that I find myself working with Magento, after installing the backup on local using Mamp, when I try to connect to the page I see the following message.
Warning: include_once(/Applications/MAMP/htdocs/amsb/includes/src/Mage_Core_functions.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/amsb/app/Mage.php on line 36
Warning: include_once(): Failed opening '/Applications/MAMP/htdocs/amsb/includes/src/Mage_Core_functions.php' for inclusion (include_path='/Applications/MAMP/htdocs/amsb/includes/src:.:/Applications/MAMP/bin/php/php7.0.22/lib/php') in /Applications/MAMP/htdocs/amsb/app/Mage.php on line 36
Warning: include_once(/Applications/MAMP/htdocs/amsb/includes/src/Varien_Autoload.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/amsb/app/Mage.php on line 37
Warning: include_once(): Failed opening '/Applications/MAMP/htdocs/amsb/includes/src/Varien_Autoload.php' for inclusion (include_path='/Applications/MAMP/htdocs/amsb/includes/src:.:/Applications/MAMP/bin/php/php7.0.22/lib/php') in /Applications/MAMP/htdocs/amsb/app/Mage.php on line 37
Fatal error: Uncaught Error: Class 'Varien_Autoload' not found in /Applications/MAMP/htdocs/amsb/app/Mage.php:54 Stack trace: #0 /Applications/MAMP/htdocs/amsb/index.php(65): require_once() #1 {main} thrown in /Applications/MAMP/htdocs/amsb/app/Mage.php on line 54
I have already cleared the cache and changed the links in the database web / secure / base_url and web / unsecure / base_url.
Can anyone help me?
As I can see from the error message you are using PHP 7 in your MAMP installation. Since PHP 7 is not officially supported by magento v1.9.x you should switch the PHP version in the MAMP settings to 5.x and everything should work.
Try to install Inchoo PHP7 compatibility extension:
https://github.com/Inchoo/Inchoo_PHP7

Exception starting server on MICO

I've made server and client using mico, but by trying to start server with
./server –ORBInitRef NameService=corbaloc::localhost:12456
I get this:
uncaught MICO exception: IDL:omg.org/CORBA/ORB/InvalidName:1.0
Problem seems to be with NameService.

Fatal error while using kartik\mpdf\Pdf in yii 2.0

I am getting following error online
Fatal error: Class 'kartik\mpdf\Pdf' not found in /home/junaidali3/public_html/magicsalon/config/web.php on line 12
where web.php is like following:
http://grab.by/GYjE
everything is working fine on wamp but when i try to run it online server it is giving fatal error
You must add this line to autoload_psr4.php :
'mPDF\\' => array($vendorDir . '/mpdf')
If mpdf extension is in root of vendor folder

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

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