Symfony and PostgreSQL — this error is driving me crazy - php

I have installed php 5.6.13, nginx, postgresql (using brew, on Mac OS)
I found in log:
PDOException: could not find driver at /project-folder//vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:40
and thought what this is simple mistake in parameters.yml, but everything is OK in parameters and config.
Command doctrine:schema:create and doctrine:fixtures:load working fine with same settings!
So I checked php:
>> php -m
PDO
pdo_dblib
PDO_ODBC
pdo_pgsql
pdo_sqlite
try clear cache: console cache:clear
remove and set up cache, logs folders with http://symfony.com/doc/current/book/installation.html
But I can not login on the site and everytime have save error PDOException: could not find driver
I have no idea — how it can loading fixtures, but can not find PDO driver, when I try to login on the site.
I tried many time remove and install php56, php56-pdo-pgsql, nginx... Any idea...
UPDATE
Problem solved after restart Mac OS.

Related

Symfony : An exception occurred in driver: could not find driver

I'm currently learning Symfony and Doctrine on Wamp, the problem is when i type the command
php bin/console doctrine:database:create
I have the following error :
In AbstractMySQLDriver.php line 110:
An exception occurred in driver: could not find driver
In PDOConnection.php line 31:
could not find driver
In PDOConnection.php line 27:
could not find driver
It's strange because i have my .env file with my DATABASE_URL correct :
DATABASE_URL="mysql://root:#127.0.0.1:3306/csi_film4?serverVersion=5.7"
I also have on WAMP, the pdo_mysql extension ticked on the Wamp, and i've made sure that the extension is in my php.ini file.
But still, i have the error when i type the command to create a database...
I also did a php -m and php -i command on my command prompt but i don't see any pdo_mysql extensions in the php modules so i kknow these modules are missing but I have no idea how can I download them.
If you have any ideas how can I install the missing modules to my php on my Wamp server, I would be glad to have them !
Thanks!
You need to install MysQl, for Ubuntu just use
sudo apt-get install php-mysql

QueryException Laravel : Driver not found

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',

PHP: pdo_oci driver does not work under apache, but does work from console

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.

Can't find MySQL driver anymore (Linux)

Today some of my packages in Ubuntu was upgraded automatically, and I didn't think of what was actually going on.
Ever since the update, my local dev-environment doesn't work anymore. First of by not working was mod_rewrite which I had to enable again using a2enmod. But now I've run into an issue that I can't seem to resolve. My application can't seem to find the PDO MySQL driver. When running the application, I get the error failed to open the DB connection: could not find driver.
This is strange, since if I check the phpinfo() the PDO drivers do support MySQL, and the socket path is a valid path.
pdo_mysql client API version is 5.5.35 according to php info.
PHP5: 5.5.3
MySQL: 5.5.35
Connectionstring
mysql:host=127.0.0.1;dbname=MyDB;port=3306
What could be causing this?
The PHP MySQL driver (mysql.so/mysqli.so) and the PHP PDO MySQL driver (pdo_mysql.so) are two separate modules. You need both of them for PDO functionality with MySQL.
It is quite possible that one of them is missing or of an incompatible version - I do not have an Ubuntu system at hand, but on my RPM-based Linux distribution there is a separate package for each module (php-mysql/php-mysqli and php-pdo_mysql). I also expect PDO to be using the newer mysqli.so driver, rather than the obsolete mysql.so one, so you should verify that one is installed as well.
Try this:
sudo apt-get install -y php5-mysql php5 mysql-client
This should automatically restart your apache if any of the dependencies aren't installed.
Try using vagrant.
Dependencies can be isolated, upgraded and downgraded when you like.
Vagrant

SYMFONY - Correctly setup PDO-MYSQL on os x 10.5

I'm having an issue with symfony and mysql setup on mac os x 10.5.8
When trying to access a newly created module, i get:
500 | Internal Server Error | Doctrine_Connection_Exception
Couldn't locate driver named mysql.
I had the same error message when trying to execute doctrine:insert-sql to create my database tables. I fixed this by downloading PDO_MYSQL and installing as per these instructions:
cd ~/Downloads/PDO_MYSQL-1.0.2/PDO_MYSQL-1.0.2
phpize
./configure '--with-pdo-mysql=shared,/usr/local/mysql'
make
sudo make install
I also added
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
extension=pdo_mysql.so
to my php.ini file.
When i do a php -m I do have pdo_mysql and PDO installed. However when I check out a phpinfo(); file with my browser, under PDO drivers, I only have sqlite and sqlite2 enabled, not mysql.
I must be missing something here! Any help with this would be greatly appreciated.
Thanks in advance.
Solved my problem by upgrading my PHP version to entropy.ch version.
Didnt work straight out of the box though, I had to manually swap my php modules over as per instructions here: https://discussions.apple.com/thread/1201106?start=0&tstart=0
Fixed in the end. Onwards and Upwards.

Categories