some1
some1

Reputation: 1737

Cannot get the mysql extension module to load for php 7.0?

I'm installing a template on Php 7.0 / MySQL 5.5 that needs the Mysql extension installed.

This is on Ubuntu 14.04, MySql version 5.5, PHP Version 7.0.7-4+deb.sury.org~trusty+1

Currently, despite having installed mysql-server and mysql-client and php7.0-mysql -- this pre-requisite installation code is still returning false:

if(!extension_loaded('mysql')){$error = TRUE; echo " Mysql PHP extension missing!";}else{echo " Mysql PHP extension loaded!";}

mysqli is installed successfully, but for some reason Php is not seeing the mysql extension and therefore I cannot proceed with my installation.

The same thing is true on a phpinfo() check -- no MySQL module to be found, instead there is pdo_mysql, mysqlnd, and mysqi.. When I check the active php ini file (in fpm folder) I don't see anything obvious in there either.

What do I need to install or enable to get the Mysql extension showing up??

Upvotes: 2

Views: 4438

Answers (2)

prosti
prosti

Reputation: 46331

Sorry, but mysql extension is not under the development. It deprecated since PHP 5.5 and was removed in PHP 7.0.

The fathers of mysql could just improve mysql to the new state but they decided to create MySQL Improved or mysqli.

The new things in mysqli that mysql didn't have:

Support for asynchronous queries.
Stored procedures
Parameterized queries
Transactions
Better security model.

Probable few more, but I cannot recall all now.

Upvotes: 0

Ben Hillier
Ben Hillier

Reputation: 2104

The mysql extension is deprecated. See http://php.net/manual/en/mysql.php

Your options are:

1) Switch to mysqli or PDO. Ideally PDO, since it supports prepared queries and is becoming the extension of choice for the PHP community.

2) If you have a lot of legacy code, then you're better off remaining with PHP 5.

Upvotes: 1

Related Questions