How to enable sqlsrv - PDO drivers in xampp ubuntu? - php

Error : PDOException could not find driver
Actually I am facing error this while working with laravel and mssql .
For that purpose I want enable sqlsrv in PDO drivers .
PDO Driver
In this image PDO drivers contain mysql, pgsql, sqlite but not sqlsrv .
So How I can fix it ?

I guess your PHP environment doesn't have PDO extension installed.
To install pdo extension, open terminal and type the below command.
First check which version of PHP is installed, to check the PHP version, type below command :
$ php -v
Suppose you have php7.1 installed, then to install pdo for your version type below
$ sudo apt-get install php7.1-pdo
Restart you apache server :
$ sudo service apache2 restart
See below snap:
After entering the command, press tab to see all the possible commands as shown in the snapshot.

Related

Xampp php_pdo_odbc not working

Xampp linux version: 7.1
OS: Ubuntu 14.04
I already uncommented extensions=php_pdo_odbc.dll in opt/lampp/etc/php.ini
but odbc is not showing
image here
you are using linux, so forget about .dll windows extension :
first you will need to check if you have the extension or not :
print_r(PDO::getAvailableDrivers());
this will print an array with the currently installed PDO Drivers,
if you didn't get the odbc driver , try to enable it :
sudo phpenmod pdo_odbc
then check again, if not installed you will need to install it :
apt-get install php7.0-odbc

How do I install PHP PDO ODBC drivers on CentOS 7?

I already have PHP 5.4 installed in a CentOS 7 VPS. I am trying now to access a legacy database in .mdb format with a PHP script.
However, my phpinfo() page says that only mysql and sqlite PDO drivers are enabled. No driver named ODBC is enabled.
Which is why I have tried to follow this tutorial to get that to work. But it doesn't work. bash: ./configure: No such file or directory.
I don't know from which folder I have to run the commands listed there. Is there a command which will allow me to install the PDO ODBC drivers from the system e.g. yum -y install php_odbc which would be easier for me to work with? If not, what am I doing wrong?
Looks like php_odbc is one of CentOS 7 packages.
See http://mirror.centos.org/centos/7/os/x86_64/Packages/ it is a very long list.
So yum -y install php_odbc should work. Just don't forget to restart your web-server if required.
You would run ./configure ... if you were compiling PHP from source. It will not work in your case.

How to enable odbc in XAMPP linux [duplicate]

Xampp linux version: 7.1
OS: Ubuntu 14.04
I already uncommented extensions=php_pdo_odbc.dll in opt/lampp/etc/php.ini
but odbc is not showing
image here
you are using linux, so forget about .dll windows extension :
first you will need to check if you have the extension or not :
print_r(PDO::getAvailableDrivers());
this will print an array with the currently installed PDO Drivers,
if you didn't get the odbc driver , try to enable it :
sudo phpenmod pdo_odbc
then check again, if not installed you will need to install it :
apt-get install php7.0-odbc

(Linux) PDO cannot find the MySQL driver

So basically I have been always developing with PHP under Windows with the WAMP package and I never had any trouble.
Now, I am trying to transition to Linux (Mint). Everything is well, except for the PDO extension which cannot find the MySQL driver. In fact, it states not having any available drivers at all.
First, I installed Apache:
sudo apt-get install apache2
Then, PHP:
sudo apt-get install php5
MySQL for PHP (I am not exactly sure this was required):
sudo apt-get install php5-mysql
Finally, the command line interface for PHP:
sudo apt-get install php5-cli
Note that I had installed MySQL a while ago for other purposes.
Everything else is working well. The server starts, runs, executes scripts. I am also able to create an instance of PDO, but then it throws a PDOException stating that it cannot find the MySQL driver. The code is typical of a PDO initialization :
$pdo = new PDO("mysql:host=127.0.0.1;db=testdb", "root", "");
I looked at the phpinfo() and for the value PDO I see no drivers. However, I see the line MySQL driver for PDO followed by the names of its authors, but I cannot tell if it guarantees the presence of the driver. Notice that I also see the authors of all the other drivers (SQLite, PostgreSQL, Oracle, etc.).
The command php -m (which, according to the php --help, lists all modules compiled with PHP) also clearly indicates that both PDO and pdo_mysql are installed.
My search returned a lot of results about the extensions pdo.so and pdo-mysql.so. I have been trying to reference them into the php.ini file without success. It would probably have a higher chance of success if I actually had these files, but so far I have been unable to find them.
So, here we are, about five hours later, with me being completely stuck.
Thank you.

MAC homebrew php pdo firebird driver

I installed php53 on mac osx with homebrew. I need to enable pdo driver for firebird.
I tried to instal via pecl ..
I donwload http://pecl.php.net/package/PDO_FIREBIRD
and compile this but I get this error
...
...
configure: error: libgds or libib_util not found! Check config.log for more information.
I found that means that I don't have installed firebird develepoment libraries...
I have installed firebird 2.0 on my mac.. this version is working Flamerobin.
Does anyone have pdo firebird driver on mac server installed via homebrew?
Pdo Firebird from pecl is deprecated , i will updated it soon that i get access to it
you need to download the source code for php extract it and then build only the pdo_firebird extension
cd ext/pdo_firebird
phpize
./configure
(you might need to pass the firebird framework dir --with-pdo-firebird=/Library/Frameworks/Firebird.framework )
make
sudo make install
after that you need to copy the extension in your brew build php extensions folder and add it to php.ini
extension=pdo_firebird.so
I also recommend firebird 2.5.x is more recent and well supported on recent macosx versions
I've solve this issue by :
sudo ln -s /Library/Frameworks/Firebird.framework/Versions/A/Firebird /usr/local/lib/libfbclient.dylib
macOS High Siera 10.13.3

Categories