|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69817 constant ''MYSQL_ATTR_INIT_COMMAND' not available on php 7.0.0alpha1
Submitted: 2015-06-13 07:40 UTC Modified: 2015-06-13 12:04 UTC
From: progfr_list at gmx dot fr Assigned: cmb (profile)
Status: Not a bug Package: PDO MySQL
PHP Version: 7.0.0alpha1 OS: Windows 10
Private report: No CVE-ID: None
 [2015-06-13 07:40 UTC] progfr_list at gmx dot fr
i have the message Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in "F:\....\fonction.php

i have check the php.ini and php_pdo_mysql.dll is loaded

Test script:
try {
    $connStr = 'mysql:host='.$DB_host.';dbname='.$DB_base; //Ligne 1
    $arrExtraParam= array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); //Error is in this line
    $pdo = new PDO($connStr, $DB_user, $DB_pass, $arrExtraParam); 
catch(PDOException $e) {
    $msg = 'ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage();

Expected result:
Connect successfull to the database

Actual result:
Fatal error message


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-13 10:51 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-06-13 10:51 UTC]
I can't reproduce this issue (php-7.0.0alpha1-nts-Win32-VC14-x64).
When pdo_mysqli is not enabled, I get:

| Fatal error: Uncaught EngineException: Undefined class constant

When pdo_mysqli is enabled, the constant is defined (its value is

Please double-check the error message (if "uncaught
EngineException" is missing, somehow another PHP installation is
interfering). And double-check that pdo_mysqli is really available
(for instance, with extension_loaded('pdo_mysql') in the script).
 [2015-06-13 11:21 UTC] progfr_list at gmx dot fr
I have checked with extension_loaded('pdo_mysql') but
i don't understand why pdo_mysql or pdo_mysqli is not loaded
because is in php.ini
 [2015-06-13 11:37 UTC]
You can verify which php.ini is loaded by looking at the output of
phpinfo, or by calling php_ini_loaded_file and
 [2015-06-13 11:47 UTC] progfr_list at gmx dot fr
forget my bug request because i break my php7 installation with previous php5 installation 

sorry my mistake !!!
 [2015-06-13 12:04 UTC]
-Status: Feedback +Status: Not a bug
 [2015-06-13 12:04 UTC]
No problem. Thanks for testing PHP 7.0.0alpha1, anyway. :)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 07:01:29 2024 UTC