Jump to content

Database Error when switching PHP versions


Recommended Posts

Hello,

My store admin page ceases to function when I switch the PHP version forward from 5.6 to either 7.0 or 7.2. The odd thing is that it seems to work fine when the PHP is 5.6 but I get the following error when I try to reload using 7.2:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in .../public_html/store/classes/db/mysql.class.php:40 Stack trace: #0 .../public_html/store/classes/db/mysql.class.php(68): Database->__construct(Array) #1 .../public_html/store/controllers/controller.admin.pre_session.inc.php(21): Database::getInstance(Array) #2 .../public_html/store/admin_OfFBtI.php(34): include('......') #3 {main} thrown in .../public_html/store/classes/db/mysql.class.php on line 40

I am using 6.2.9

Any help is appreciated!

Thanks,


Matt

Link to post
Share on other sites

PHP 7+ has removed the ability to communicate with the database server via the PHP connector extension mysql. Instead, PHP now insists on using the connector extension mysqli (note the 'i' at the end).

CubeCart has distinct code that uses mysql and distinct code that uses mysqli.

There is no compulsory setting to force one over the other.

However, in /includes/global.inc.php, examine the contents of that file to determine if there is a statement that reads:

$glob['db'] = 'mysql';

If there is, delete it.

Does your storefront load under PHP 7? If yes, then the problem is not from forcing or detecting the wrong mySQL connector. There could be a plugin that has been coded incorrectly.

Link to post
Share on other sites

Hi bsmither.

Thank you for the quick response. Checked the global.inc.php file, that line was not in there. Narrowed the issue down to 2 or 3 plugins, and deactivated them - which seemed to do the trick.

Consider this resolved! As always, very much appreciated.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...