I am trying to set up a driver for Oracle on a PHP script on CentOS7 with Apache.
I have followed the steps at:
And OCI does show up in phpinfo(), but whenever I try to use the driver, it throws a PDOException that it can't find the driver.
Please help.
Thank you.
Related
Hello i am trying to build a webapp using oracle DB.
So I created connect.php using PDO to access the Oracle database. But i get the message: could not find driver
So i am using apache2 and in my php.ini this extensions are activated:
extension=oci8_12c ; Use with Oracle Database 12c Instant Client
extension=oci8_19 ; Use with Oracle Database 19 Instant Client
extension=odbc
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
Maybe i am missing some packages or extensions? Can u help me out? I my phpinfo i cant find an extra section for oci and i guess thats bad?
I am working on Ubuntuu VM but my database is on another server. I have Installed PHP 8.1.2
please help me to eliminate this php error
Just run
sudo apt install php-mysql
in terminal
Hi I have also faced this issue but this article helped me you no need to edit .ini file just follow this article
PDOException: could not find driver
I installed Microsoft SQL Server 2014 (x64)-Express and install the SQL Server Drivers for PHP 7, did changes in php.ini file also, still i am getting error while connecting php to mssql server database 'connection failed. could not find the driver'. Please help me to solve this error.
In my case, in order to access a MS SQL server database from PHP I had to do the following:
Have a PHP version installed that is compatible with microsoft SQL Server executables. Install PDO, PDO_sqlsrv driver and PDO_odbc driver.
Check the following link for instructions on how to install it.
https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver16
I am facing a strange error with laravel under ubuntu using PostgreSql.
Its NOT a PDOException. The database migration is successful so all driver are set and PDO connection is also established. But why this error?
Didn't find much about it in google. I am attaching the screenshot.
This is NOT homestead rather own lamp stack.
Edit:
There is no problem even with tinker
Regards
I resolved this issue using the following command:-
sudo apt install php7.4-pgsql (replace 7.4 with your php version)
To check PHP version use: php -v
For more info visit: https://www.php.net/manual/en/pgsql.installation.php
Please check php info and serach "PDO Driver for PostgreSQL" or "pdo_pgsql" after run the above command
keywords :- for pgadmin, pgsql, postgresql, PDO Driver for PostgreSQL, pdo_pgsql #vasimraja
Please check the default key in app/config/database.php
For postgres, default should be 'default' => 'postgres',
I'm having a very puzzling situation with PHP PDO and Oracle. I'm
running on Centos 7. My script, under Apache gets the error
"ERROR:could not find driver", however the script runs fine from the command line.
From the command line when I run a test script to list the drivers:
foreach(PDO::getAvailableDrivers() as $driver)
echo $driver, '', "\n";
it returns:
mysql oci pgsql sqlite
but when run under apache, oci is missing:
mysql pgsql sqlite
To add to this mystery, running phpinfo() shows in the section
"Additional .ini files parsed" an entry for /etc/php.d/pdo_oci.ini (for both console and apache).
Any ideas as to why the oci driver is not showing up when the script
is run under apache?
I "solved" this problem by punting on getting it to work using the Oracle installation configuration. I installed Instant Client and that got PHP to recognize the oci module both in command line and under apache (building pdo_oci with ./configure --with-pdo-oci=instantclient,/usr,11.2)
There were further issues with unrecognized TNS_ADMIN values. I worked around that by using the alternative PDO DSN spec for Oracle connections:
oci:dbname=//HOST[:PORT]/SERVICE_NAME
Thanks to anyone kind enough to have spent time on this. This experience, like many Oracle-related ones, reminds me why I use Postgres.
I'm getting error of PDO cannot find driver using PDO in environment. I'm using xamp on a Mac.
I had got to know the problem and I've installed freetds using homebrew install, and had successfully connected to the azure mssql server using below command
tsql -H 234fddfg.database.windows.net -p 1433 -U dbuser -P db123!
but I don't know what to do next.
I've tried below php code but I'm still getting the same error.
$dbh = new PDO("sqlsrv:Server=localhost;Database=mydb", "dbuser", "db123");
Driver for Microsoft SQL Server for PHP is needed to be installed for this.
Follow this link:
https://www.microsoft.com/en-in/download/details.aspx?id=20098
Perform the following steps to download and install the Microsoft Drivers for PHP for SQL Server (example below for 3.2 version):
1. Download SQLSRV32.EXE to a temporary directory
2. Run SQLSRV32.EXE
3. When prompted, enter the path to the PHP extensions directory
4. After extracting the files, read the Installation section of the SQLSRV32_Readme.htm file for next steps
Now just add the following line to your PHP.ini (this is for the non-thread safe version of PHP, which you are most likely using when you have installed PHP to use IIS FastCGI, which we recommend):
extension=php_sqlsrv.dll
And Restart server
Have you installed PDO_DBLIB, it seems that in OSX, we need to leverage PDO_DBLIB as the pdo driver connecting to MS SQL, e.g.
$pdo = new PDO("dblib:host=$dbhost;dbname=$dbname", "$dbuser","$dbpwd");
you can refer to Configure PHP environment on Mac to connect to SQL Server using PDO interface for more information.