I'm using zend framework, and I have to connect to a microsoft sql db 2005. I've installed all the needed packages through the packet manager (homebrew) following (this tutorial), I've successfully downloaded the version of php5.5 with pdo_dblib. Then the problem started.
Is the php installation valid for Zend framework and zend studio too? Since, the error that I was getting when trying to connect to the db hasn't changed at all so there must be a mistake;
When I run:
php -i | grep -i pdo
The output is:
API Extensions => mysqli,pdo_mysql,mysql
PDO
PDO support => enabled
PDO drivers => mysql, sqlite
pdo_mysql
PDO Driver for MySQL => enabled
pdo_mysql.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
So, where is my new installation with php 5.5 and pdo-dblib and mssql?
I'm quite confused...
PS: I'm running OSX 10.9
I've found a tutorial which explains how to link the new version of php. Specifically what is interesting of it is in those two lines of code:
nano ~/.bash_profile
export PATH="$(brew --prefix josegonzalez/php/php55)/bin:/usr/local/bin:$PATH"
now the command:
php -i | grep -i pdo
gives the following output (with pdo dblib):
API Extensions => mysqli,pdo_mysql,mysql
PDO
PDO support => enabled
PDO drivers => dblib, mysql, odbc, sqlite
pdo_dblib
PDO Driver for FreeTDS/Sybase DB-lib => enabled
pdo_mysql
PDO Driver for MySQL => enabled
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
PDO_ODBC
PDO Driver for ODBC (unixODBC) => enabled
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
Related
Connecting to MySQL Database through PDO is showing could not find driver but output of php -i | grep PDO is:
PDO
PDO supported => enabled
PDO drivers => mysql
PDO Driver for MySQL => enabled
and ouput of php -m contains :
PDO
pdo_mysql
I have just started learning PHP and Mysql and I have a problem when I run php file.
error :could not find driver
This is version that I am using:
I tried to follow answers of question that similar but still can not solve the problem.
It appears you have a simple typographical error in your code. You defined your DSN with the string msql:dbhost=localhost...
But you should use mysql:dbhost=localhost...
See http://php.net/manual/en/ref.pdo-mysql.connection.php for reference docs on the MySQL DSN format.
You have installed php-pdo but you might also need either php-mysql or php-mysqlnd (prefer the latter).
You can check by running php -i | less to give a lengthy report of all the extensions currently installed. Look for the "PDO" section, and confirm that the mysql driver is among the drivers installed:
PDO
PDO support => enabled
PDO drivers => sqlite, mysql, sqlite2
If it does, it should be followed by a "pdo_mysql" section. Mine looks like this:
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $
Directive => Local Value => Master Value
pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock
If you don't have the pdo_mysql section, you should install the corresponding yum package for it:
sudo yum install php-mysqlnd
I am learning Laravel and migrations. I have installed Homestead successfully and everything is be up and running — MySQL included — until I give my first
php artisan migrate
and the shell outputs
[PDOException]
could not find driver
so I connect to the virtual machine via SSH and try to install the PHP extensions required to work with the database, but apt-get detects I have the latest driver version already installed. Then I check to see if PDO is working, so I type php -i | grep PDO and everything looks good:
PDO
PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled
I am out of ideas, what could possibly go wrong?
I've configured pdo_informix:
[root#cc-allplus nginx]# php -i |egrep "pdo|PDO"
PDO
PDO support => enabled
PDO drivers => sqlite, sqlite2, odbc, pgsql, informix, dblib
pdo_dblib
PDO Driver for FreeTDS/Sybase DB-lib => enabled
pdo_informix
pdo_informix support => enabled
PDO_ODBC
PDO Driver for ODBC (unixODBC) => enabled
pdo_pgsql
PDO Driver for PostgreSQL => enabled
Revision => $Id: pdo_pgsql.c 300351 2010-06-10 12:11:19Z iliaa $
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
and trying out to create connection :
try{
$dbh = new PDO ("informix:host=some.example.ru; service=50000; database=test; server=test_net; protocol=onsoctcp;DB_LOCALE=en_US.57372; CLIENT_LOCALE=en_US.57372;", "dcs_test", "********");
}catch (PDOException $e){
echo 'Failed to execute your db connection: '. $e->getMessage().'</br>'; exit;
}
And the response is :
Failed to execute your db connection: SQLSTATE=HY000, SQLSetConnectAttr: -11097 [Informix][Informix ODBC Driver]Optional feature not implemented
Googling not helped with resolving this issue.. any suggesions are welcome
Problem was solved.
For those who might stuck with the same troubles with informix or others pdo's libraries I would like to share.
My trouble was in choosing the latest version of PDO_INFORMIX soursec. As I searched and discovered, php 5.3 need informix not later than 1.2.6 version.
I discovered that information from an article in Hungarian language, and it was the only post about such incompatibility between php and PDO_INFORMIX in whole www.
Not any string of such info at IBM site, nor at pdo PECL sources site.. God, that take me a few days, but I did it!
After I found right version I had to recompile the php, cause it have put 1.3.0 version of informix pdo in cache and didn't want to work with older one.
Hope that would help!
I cannot get PHP to connect to PGSQL. I am running Mavericks 10.9.4. Here are the steps I followed:
Figured out where default PHP w/ mac was living (which php)
rmdir that directory
brew install php54
php -v shows new php 5.4
php -m shows no pdo_pgsql module
brew install php54-pdo-pgsql
php -m show pdo_pgsql module
php -ishows the following info
.
PDO support => enabled
PDO drivers => mysql, odbc, sqlite, pgsql
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $
Directive => Local Value => Master Value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
PDO_ODBC
PDO Driver for ODBC (unixODBC) => enabled
ODBC Connection Pooling => Enabled, strict matching
pdo_pgsql
PDO Driver for PostgreSQL => enabled
PostgreSQL(libpq) Version => 9.4.4
Module version => 1.0.2
Revision => $Id: 8e4cc97fb53f418d98b489c3e9d722e48446e676 $
Open /usr/local/etc/php/5.4/php.ini and add extension=pgsql.so, then save
sudo apachectl restart
Open phpinfo() page
PDO drivers section only shows mysql, sqlite
Loaded Configuration File section shows php.ini same file w/ the pgsql extension
Also whenever I run a php command in console I see
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so' - dlopen(/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so' - dlopen(/usr/local/Cellar/php54/5.4.43_2/lib/php/extensions/no-debug-non-zts-20100525/pgsql.so, 9): image not found in Unknown on line 0