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.
Related
My server is centos7, I managed to setup apache,php7.1,oracle-instantclient18.3-basic and oci8 on it. OCI8 is working fine now when I run the code on CLI, it connects the db and fetches data, only with one warning (also appears on running php -v) :
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_oci.so' - /usr/lib64/php/modules/pdo_oci.so: undefined symbol: php_pdo_unregister_driver in Unknown on line 0
unlike when I open up the page via browser (on a client machine) I got this error:
Fatal error: Uncaught Error: Call to undefined function oci_connect() in /var/www/html/pcmapi/emp.php:5 Stack trace: #0 {main} thrown in /var/www/html/pcmapi/emp.php on line 5
phpinfo() returns:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => enabled
OCI8 Version => 2.1.8
Oracle Run-time Client Library Version => 18.3.0.0.0
Oracle Compile-time Instant Client Version => 18.3
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
I cannot actually recognize what causes the fatal error whether in apache or oci configuration and I find it strange that oci functions are working fine on cli but not apache. any help?
The solution is to make sure you are loading pdo.so before you load pdo_oci.so.
I do not know the exact configuration you are using, but on Ubuntu for example, I have the pdo_mysql.so loading after pdo.so by having these configuration files in the PHP's conf.d:
10-pdo.ini:
extension=pdo.so
20-pdo-mysql.ini:
extension=pdo_mysql.so
Notice that the file 10-pdo.ini will load earlier than 20-pdo-mysql.ini simply because of its file name.
Good luck.
The common issue is that Apache doesn't have the Oracle client libraries (e.g. Instant Client) in its library search path. The reason PHP works in command line is because your shell does have the library search path correctly set.
If you don't have other Oracle libraries on this computer then do:
sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
If you do have other software that would conflict, then do something like edit /etc/sysconfig/httpd and add:
LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib
Depending on your Apache version, how you set the environment varies (yay!)
You may or may not need to export this:
export LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client64/lib
On other systems you can use Apaches envvars file.
Thanks for your time, I actually did reinstall all the environment over again, this was painful as its a production server but paid back..
while I had mysql & instantclient already setup, I removed php & httpd then reinstall them all as the following:
yum install httpd php php-mysql php-devel php-oci8 php-pear mod_ssl
and then:
service httpd restart
now it works.
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 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 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.