Bug #69817 [Fbk]: constant ''MYSQL_ATTR_INIT_COMMAND' not available on php 7.0.0alpha1
| From: | cmb@php.net | Date: | Sat, 13 Jun 2015 11:37:30 +0000 |
| Subject: | Bug #69817 [Fbk]: constant ''MYSQL_ATTR_INIT_COMMAND' not available on php 7.0.0alpha1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193392@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69817&edit=1
ID: 69817
Updated by: cmb@php.net
Reported by: progfr_list at gmx dot fr
Summary: constant ''MYSQL_ATTR_INIT_COMMAND' not available on
php 7.0.0alpha1
Status: Feedback
Type: Bug
Package: PDO MySQL
Operating System: Windows 10
PHP Version: 7.0.0alpha1
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2015-06-13 11:21:00] 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 10:51:24] 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 07:40:40] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69817&edit=1