A Database connection using "Mysql" was missing or unable to connect - php

My code is executing properly on development. But on production gives following error:
Missing Database Connection
Error: A Database connection using "Mysql" was missing or unable to connect.
The database server returned this error: Selected driver is not enabled
Error: Mysql driver is NOT enabled

Mysql extension on PHP 5.5.x and above is deprecated.
On PHP 7 mysql has been removed.
You should use PDO. If you can't, then try to replace your mysql with mysqli extension.

I got the same error, but it resolved with this
yum install --enablerepo=remi,remi-php70 php-mysqlnd

Related

I am getting sql server connection error with xampp

Actually, I followed all the paths in the document, but I still get an undefined sql error while connecting.
I followed these paths respectively.
1-Microsoft® ODBC Driver 11 for SQL Server® install
2-Microsoft Drivers for PHP for SQL Server this version: 7.3
dll files in the corresponding folder
php / ext
php_pdo_sqlsrv_73_nts_x64.dll
php_pdo_sqlsrv_73_ts_x64.dll
then I restarted xampp, i viewed phpinfo
But when I run my file the error I get is:
Fatal error: Uncaught Error: Call to undefined function
sqlsrv_connect() in
what could be missing?
You need to enable PHP Driver for SQL Server, but not PDO version. Function sqlsrv_connect() and all sqlsrv_ functions are part of the SQLSRV driver.
To enable the SQLSRV driver, you need to modify the php.ini by adding the appropriate line to the extension section - php_sqlsrv_73_nts_x64.dll or php_sqlsrv_73_ts_x64.dll depending on the PHP version.
Of course, as an option, you may try to rewrite your code using PDO (PHP Data Objects). The PDPO_SQLSRV part of the driver is installed on your WEB server.

Connecting to Sybase database using Doctrine orm and php7

I am creating a web application in php 7.2 and need to connect to a Sybase database. I am using Doctrine orm.
I have tried using the sqlanywhere driver and the pdo_sqlsrv driver to connect to Sybase.
However with sqlanywhere I am getting the error:
Warning: sasql_pconnect(): SQLAnywhere: [-832] Connection error: Connection was dropped (may not be a SQL Anywhere server)
With pdo_sqlsrv I get the error:
PDOException: SQLSTATE[HY000]: [Microsoft][ODBC Driver 13 for SQL Server]Protocol error in TDS stream.
I have googled both these errors and have not been able to resolve either.
Does anyone have any suggestions for how to connect to Sybase using php7.2 and Doctrine orm?

Uncaught Error: Call to undefined function mysqli_connect() when connecting to the database [duplicate]

This question already has answers here:
How can I enable the MySQLi extension in PHP 7?
(8 answers)
Closed 6 years ago.
I get an error when trying to connect to my database with mysqli on PHP 7.0 and PHP 7.1
PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /home/mywebsite/public_html/connection.php:7
$conn = mysqli_connect($DBhost,$DBuser,$DBpass,$DBname);
First check, if mysqli is enabled: phpinfo()
The mysqli PHP extension is not installed on your server. Contact to your server administrator.
OR
If you host the server yourself, in the php.ini file remove the semicolon in front of the extension extension=php_mysqli.dll.
Hope, this helps you
I would recommend using PHP PDO for database connection. Its got better performance and I think the code looks better.
But to speak on your error, it looks like php doesnt have a reference to mysqli library. Did you explicitly install the php-mysql package? Its also possible that the environment variable path is not pointing to the right location on the filesystem.
Your php not instaled mysql connector ,
for install linux :
sudo install php-mysqli
Happens when php extensions are not being used by default.
In your php.ini file, change
;extension=php_mysql.dll
to
extension=php_mysql.dll.
The mysqli PHP extension is not installed on your new server.
Contact to your server administrator.
If you host the server yourself, in the php.ini file remove the semicolon in front of the extension extension=php_mysqli.dll

wamp php5.3.5 mssql_connect() Fatal error

I am using WampServer Version 2.2, php5.4.3 , Apeache2.2.22 I could not use mssql_connect(), "mssql_connect() Fatal error: Call to undefined function mssql_connect()" I went through googling but still not found solution.
It is always better to use PDO which supports ms sqlserver and other databases, you can use the syntax
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
or you can refer the documentation https://secure.php.net/manual/en/pdo.connections.php
You don't have the MS SQL Drivers installed. You can check this with phpinfo();
On Linux you need mssql.so or sybase.so With debian its apt-get install php5-sybase
For windows take a look here
Drivers need to be configured for PHP to find the function
mssql_...
You could also look at PDO DB classes as they can connect to any DBS, you need the drivers installed tho.

How do I connect mssql with PDO using php 5.4.19

I am gettin following error when I connect to mssql
Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server
And I am using
$db = new PDO("sqlsrv:server=127.0.0.1;database=test;", "sa", "mypassword");
I have also added driver in C:\xampp\php\ext and set that extension in php.ini file
[PHP_PDO_MSSQL]
extension=php_pdo_sqlsrv_54_ts.dll
I have tried several tutorials, what exactly I am doing, Please tell what I am doing wrong?
what version of the php pdo sqlsrv are you using?
Try updating it to v3.1
http://www.microsoft.com/en-us/download/details.aspx?id=20098
You might neet the ODBC driver as well:
http://www.microsoft.com/en-us/download/details.aspx?id=36434

Categories