php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: progfr_list at gmx dot fr
New email:
PHP Version: OS:

 

 [2015-06-13 07:40 UTC] progfr_list at gmx dot fr
Description:
------------
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:
---------------
<?php
$DB_host='localhost';
$DB_base='db_base';
$DB_user='userlog';
$DB_pass='password';
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); 
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
    $msg = 'ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage();
    die($msg);
}


Expected result:
----------------
Connect successfull to the database

Actual result:
--------------
Fatal error message

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-13 10:51 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-06-13 10:51 UTC] cmb@php.net
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
| 'MYSQL_ATTR_INIT_COMMAND' ...

When pdo_mysqli is enabled, the constant is defined (its value is
1002).

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] cmb@php.net
You can verify which php.ini is loaded by looking at the output of
phpinfo, or by calling php_ini_loaded_file and
php_ini_scanned_files.
 [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] cmb@php.net
-Status: Feedback +Status: Not a bug
 [2015-06-13 12:04 UTC] cmb@php.net
No problem. Thanks for testing PHP 7.0.0alpha1, anyway. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC