I have installed the module with php ( ./configure --with-pdo-pgsql=/var/lib/postgresql/9.3/main), but I obtain one more time the same error: Fatal error: Call to undefined function pg_connect(). In my configuration file of php, php.ini, the postgresql pdo_pgsql module appears as loaded:
pdo_pgsql
---------
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 9.3.4
Module version 1.0.2
Revision $Id$
pdo_pgsql is the PostgreSQL driver for PDO.
If you need pg_connect, you should install the PostgreSQL extension.
Related
I'm running Symfony but it doesn't find pdo drivers and the demo application throws exception of SQLite3 exceptions.
The configuration checkers says:
PDO should have some drivers installed (currently available: none)
Install PDO drivers (mandatory for Doctrine).
But in php.ini I have:
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
In the end, the symfony app says:
// Check if SQLite is enabled
if ($isDriverException && $this->isSQLitePlatform() && !extension_loaded('sqlite3')) {
$event->setException(new \Exception('PHP extension "sqlite3" must be enabled because, by default, the Symfony Demo application uses SQLite to store its information.'));
}
But I knew that with PHP 5.3+ it's installed by default.
I'm running on windows with PHP7.1 installed
When I ask the drush status while im in the folder of the website I get this message
/volume1/web/drupal8 $ drush status
PHP Fatal error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in
phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php on line 56
Fatal error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in
phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php on line 56
Drush command terminated abnormally due to an unrecoverable error.
[error] Error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in
phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php, line 56
When I ask the drush status while im in the bin folder drush seem to work
/bin$ drush status PHP configuration : /etc/php/php.ini PHP OS
: Linux Drush script : /usr/local/bin/drush Drush
version : 8.1.5 Drush temp directory : /tmp Drush
configuration : Drush alias files :
I can't figure out what im doing wrong, how can I run drush on folder /volume1/web/drupal8?
thanks in advance
PDO is installed and enabled. I run php56 -i
PDO PDO support => enabled PDO drivers => dblib, mysql, pgsql, sqlite
pdo_dblib
PDO Driver for FreeTDS/Sybase DB-lib => enabled Flavour => freetds
pdo_mysql
PDO Driver for MySQL => enabled Client API version => mysqlnd
5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd 41fc93cccd5bac2fe7a $
Directive => Local Value => Master Value pdo_mysql.default_socket =>
/run/mysqld/mysqld.sock => /run/mysqld/mysqld.sock
pdo_pgsql
PDO Driver for PostgreSQL => enabled PostgreSQL(libpq) Version =>
9.3.6 Module version => 1.0.2 Revision => $Id: 0e858dd2051ca8c2fd3c781909a0670ab5fecd36 $ pdo_sqlite
PDO Driver for SQLite 3.x => enabled SQLite Library => 3.10.2
Probably, you don't have properly installed PDO_MYSQL. You need to invoke phpinfo() function and see if this module is present. The constant MYSQL_ATTR_SSL_CA comes from PDO library. If php is invoked from CLI then probably it has its own php.ini so you need to enable PDO there as well.
To check if you have enabled PDO in PHP CLI run php -m |grep PDO the command should return PDO string.
To install PDO check the PHP Manual for Installing PDO.
I face this issue as well on all drupal 7 and 8 directory, while drush works fine outside drupal, it doesn't work in Drupal directory. the error says:
Error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in Drush\Sql\Sqlmysql->creds() (line 56 of phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php).
Installing php-mysql (or php5-mysql) fix the issue.
I've added the following lines in php.ini
extension=pdo.so
extension=mysql.so
extension=pdo_mysql.so
But I'm still only getting sqlite support in phpinfo(); and a PHP app I'm trying to install shows "PHP PDO MySQL Module: Not Found".
however php -m gives the following list:
bcmath
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib
As it turns out the php-mysql package was an error state, I followed the instructions in another answer to resolve it
php-mysql version conflicts with Mysql server
if using windows just uncomment
extension_dir = "ext"
in php.ini
You have an CentOS(Red Hat(Linux)). You need to install the php_module like that:
sudo apt-get install php5-mysql
Then do an apache restart Like that:
sudo service apache2 restart
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
I am trying to compile pdo.so and pdo_mysql.so to get pdo support on my PHP5 install.
I tried the following :
./configure --prefix=/thedirectory --with-mysql --with-pdo-mysql --enable-pdo
Compilation is successful but the .so aren't generated.
I am supposed to have/specify a mysql installation?
Is the pdo support supposed to be compiled within php core ?
If I run a php -m I can see PDO and pdo_mysql registered, but a phpinfo() states no pdo_mysql support.
I guess the php -m just tells me php has pdo support but still need the .so?
Could anyone advise?
Thanks
Use the following configure options:
./configure \
--with-mysqli=/home/user/programs/mysql/install/bin/mysql_config \
--with-pdo-mysql=/home/user/programs/mysql/install
The /home/user/programs/mysql/install directory is where MySQL has been installed.
You should see a pdo_mysql section in the phpinfo() output showing the following:
PDO Driver for MySQL enabled
Client API version 5.7.16
The latest versions of PHP come with PDO drivers for MySQL, Oracle, PgSQL, ODBC, SQLite and Firebird/Interbase. All you have to do is enable them in your php.ini:
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
Here I have MySQL, and PgSQL enabled while all others are disabled.
(This is from a php.ini file from Windows, but on linux it looks pretty much the same, just the extensions are in the form of pdo_mysql.so, pdo_pgsql.so, etc.)