some1 some1 - 1 year ago 197
MySQL Question

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

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??

Answer Source

The mysql extension is deprecated. See

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download