opencart Error Found in my website - php

I have already transformed my Website from one server to another. Everything is working fine. When I try to open my side I found this error message
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/haratistore/public_html/system/database/mysql.php on line 6
My Domain is http://haratistore.com/
Please advise me ...haw can I fix this type of a error

UPDATE
Open opencart/config.php and opencart/admin/config.php.
Change mysql to mysqli
e.g.
//define('DB_DRIVER', 'mysql');
define('DB_DRIVER', 'mysqli');

I think your Opencart version is older 1.5.X so there is two options here:
1) you should upgrade your OpenCart to 2.x.x
2) I have developed for older version OpenCart PDO class which you have to upload in your opencart > system > database
Opencart-PDO

Related

Wordpress Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /wp-includes/wp-db.php:1570

I am in big trouble. I installed a nulled version of woocommerce cart based shipping plugin and i found it not relevant according to my requiremnet and deleted that plugin from plugins area. After deleting that plugin my site went down. Its continuously showing me Fatal error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/dev/public_html/new/wp-includes/wp-db.php:1570
Stack trace:
#0 /home/dev/public_html/new/wp-includes/wp-db.php(658): wpdb->db_connect()
#1 /home/dev/public_html/new/wp-includes/load.php(404): wpdb->__construct('dev_test', 'password', 'dev_test_ne...', 'localhost')
#2 /home/dev/public_html/new/wp-settings.php(107): require_wp_db()
#3 /home/dev/public_html/new/wp-config.php(82): require_once('/home/dev/p...')
#4 /home/dev/public_html/new/wp-load.php(37): require_once('/home/dev/p...')
#5 /home/dev/public_html/new/wp-blog-header.php(13): require_once('/home/dev/p...')
#6 /home/dev/public_html/new/index.php(17): require('/home/dev/p...')
#7 {main} thrown in /home/dev/public_html/new/wp-includes/wp-db.php on line 1570
I tried replacing all core files excluding wp-config.php and wp-content folder. Still I am getting the same error.
Also, i tried renameing plugins folder but the error is there.
Can you guys suggest me how i can get my site back.
I encountered this problem upgrading from PHP 5 to PHP 7 (on Windows). The problem was mysqli PHP extension was not enabled. If mysqli is not available Wordpress 5+ detects this and will instead attempt to connect to the database with deprecated mysql_connect() calls. This leads to a very misleading error message about mysql_connect() function not being available (since we don't want this function).
In php.ini make sure extension_dir is set (use full directory name) and mysqli extension is enabled
extension_dir = "C:\php-7.3.10\ext"
...
extension=mysqli
To double check what extensions are active you can run the following code
<pre>
<?php print_r(get_loaded_extensions()); ?>
</pre>
Possible error sources:
Since PHP 7, mysql_* functions have been removed, see PHP's official overview of the MySQL drivers.
You use PHP 5.x and have not enabled the mysql extension, but mysqli and/or pdo_mysql instead.
You can set
define('WP_USE_EXT_MYSQL', true);
in your wp-config.php file to make WordPress use the mysqli extension.
It happens for me when I switch from 5.6 php to 7.0.
Just enable "mysqli" in your select php version if you use cPanel.
Just registered to give a big thank you for the solution of enabling mysqli. I have been struggling to get WordPress running on a Synology for the past 3.5 hours and this finally fixed my dreaded "The site is experiencing technical difficulties."
For any other Synology users ending up in this topic after trying to find a solution, to fix this on Synology, you need to...
Go to Web Station
Select PHP Settings
Double-click the PHP profile you are using (or click once and choose [Edit])
Select General Settings and scroll to the extensions list
Find mysqli and enable by placing a checkmark
Push the [OK] button (no restart required)
Please check your wp-config.php file for the following line:
define('WP_USE_EXT_MYSQL', true);
If you find it, delete the line. Your problem should be fixed.
If not, you can tick nd_mysqli extension in the PHP 7 configuration, and disable the mysqli extension on Cpanel -> Select PHP version.
Source:
https://wordpress.org/support/topic/database-cache-causing-503-errors-when-upgrading-to-php-7/
Hope this helps. :)
The error seems be simple, mysql_* functions are not enabled.
Check with phpinfo() if these functions are truly disabled, and if yes, enable it.
If no, there are some problems in the code that you are using, but if you have replaced all files as you write, is most probably the first option.
Just had a similar problem with a cpanel multiphp instance. Tried just about everything but while cpanel/whm was saying all was fine, the site would crash when 7.x was activated.
In the end, it was the .htaccess file. We renamed and let Cpanel regenerate and all is good.
Hope this helps someone out there as it took some time to resolve here.
i had same kind of issue for my web hosting client at magicworkshost , i have updated php version from 5.6 to 7.3 and issue resolved successfully.
Thanks
sudo apt-get install php7.4-mysql
sudo service apache2 restart

Compiled PHP 7 missing mysql extension in WordPress

I have built PHP 7 with a configuration that worked for a previous version of PHP.
Now my WordPress websites get the message:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Other websites using mysqli do work. What am I missing?
I've also included all .so files with mysql in the name:
extension=dba.so
extension=mysql.so
extension=mysqli.so
extension=mysqlnd_mysql.so
extension=mysqlnd_mysqli.so
extension=mysqlnd.so
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_odbc.so
extension=odbc.so
PHP 7 has removed mysql_* completely.
You need to use PDO or mysqli. Wordpress seems not to support this.
mysql_* functions got deleted in PHP 7.0 update your code to mysqli or PDO
Also take a look at prepared statements if you are handling user input. To reduce the chance of SQL injections
An example of mysqli connection string:
<?php
$mysqli = new mysqli("localhost", "user", "password", "database");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
?>
An example of pdo connection string:
<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
?>
Note:
That mysqli example handles a connection error
As has been mentioned elsewhere, the ext/mysql functions have been removed. We've been talking about this for some time.
ext/mysql was built for MySQL 3.23 and only got very few additions since then while mostly keeping compatibility with this old version which makes the code a bit harder to maintain.
If you're hell-bent on putting them back in, you can add them back to PHP 7 by using the ext/mysql PECL Library
It's important to note that Wordpress 3.9 or later supports mysqli
In WordPress 3.9, we added an extra layer to WPDB, causing it to switch to using the mysqli PHP library, when using PHP 5.5 or higher.
Check if the Wordpress still using the Mysql extension that was removed in PHP7.
http://php.net/manual/en/migration70.removed-exts-sapis.php
The Mysqli and PDO extensions were kept. This is the reason your other websites are working.
This issue is caused by php 7.1.0-dev.
I built another one with the same configuration version 7.0.0 and the issue was resolved.
This has nothing to do with WordPress since it will automatically try to use MySQLi when MySQL is not found. At least in WP 4.4.
On Ubuntu, I fixed this error by running
sudo apt-get install php-mysql
And then restarting my server (caddy, but you might be using apache or nginx).
source

OpenCart: Fatal Error: Class 'Mysqli' Line 7

I have problem for installation OpenCart in cPanel with Softacolous, when I'm finished for install and during open the site I have message:
Fatal error: Class 'mysqli' not found in /home/radiance/public_html/shoukhin/system/library/db/mysqli.php on line 7
==Info:==
OpenCart:
Version: 2.0.3.1, 1.5.6.4
Release Date: 29-05-2015
Anything more to solve or get ans? Anyone there to solve it?
Please install mysqli into your centos server .
To install mysqli using EachApache:
Login to WHM as 'root' user.
Either search for "EasyApache" or go to Software > EasyApache
Scroll down and select a build option (Previously Saved Config)
Click Start "Start customizing based on profile"
Select the version of Apache and click "Next Step".
Select the version of PHP and click "Next Step".
Choose additional options within the "Short Options List"
Select "Exhaustive Options List" and look for "MySQL Improved extension"
Click "Save and Build"
I recently faced the same issue, that Class mysqli not found. And found out that this particular issue is not related to OpenCart. It is related to the PHP version that your OpenCart is using and the PHP version that your server is supporting.
So make sure sure PHP version mentioned during configuration is matched with PHP version that your server is running.
In my case my server was running PHP 7.4 and OpenCart was configured for PHP 7.3. So the problem was solved by changing my server's PHP version to 7.3.
And lived Happily forever after....
In cPanel, just goto your php version, make sure you are on 7.3 and enable nd_mysqli. That fixed it for me.

Using SQL Server in Cake PHP: PHP SQL Server interface is not installed

I inherited an old Cakephp site that was using adodb as a driver to connect to an MSSQL database and it turns out this is no longer supported in the new version of cake (1.3, we are in 1.2) so I'm trying to change the driver so I can upgrade. We're using IIS and a sql server 2005 database on a different server, php 5.2.17. However using driver "mssql" gives me the following errors:
PHP SQL Server interface is not installed. For troubleshooting information, see http://php.net/mssql/
Call to undefined function mssql_min_message_severity()
The top error leads me to a page regarding the old php_mssql.dll, which according to this question: ( CakePHP: error when trying to use mssql datasource ) will become a problem when I switch to PHP 5.3 so I'm trying to use the php_sqlsrv*.dll for my php version but I still get the error. Could never get the mssql.dll one to work either. I do however see "sqlsrv support enable" in phpinfo.php and the whole sqlsrv section is intact there.
In cake php I'm using "driver => 'mssql'", is this the correct driver for the new sqlsrv dll? Is there something I'm missing? For kicks I tried 'driver' => 'sqlsrv', that fixes the php SQL Server interface error but I still get
"Fatal error: Call to undefined function sqlsrv_min_message_severity() in C:\Inetpub\wwwroot\riverstone-dev\www\cake\libs\model\datasources\dbo\dbo_sqlsrv.php on line 107"
Installing the latest SQL Native Client set from Microsoft and reenabling the extension in PHP has worked, albeit on a different server. Please try the drivers below if having a similar problem:
http://www.microsoft.com/download/en/details.aspx?id=20098

Problem in connectivity with mysql in php

I am trying connectivity with mysql in php. But it shows an error message at this line.
$con = mysql_connect('localhost','root','admin');
fatal error: Call to undefined function mysql_connect()
My guess is that the MySQL Extension has not been enabled/installed:
http://www.php.net/manual/en/mysql.installation.php (the original mysql extension)
or
http://www.php.net/manual/en/mysqli.installation.php (the newer mysql extension)
P.s. I would recommend skipping those and using PDO :)
Are you sure you have MySQL installed ?

Categories