|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-08-16 23:59 UTC] dpfender44 at gmail dot com
Description: ------------ In both PHP versions 7.3.9RC1 and 7.4.0beta2, the php.ini file does not have the ODBC (extension=odbc) configured, but the ODBC functions work properly. If the ODBC module is now part of the core PHP system, then the extension=odbc option in the php.ini file needs to be removed. In PHP version 7.3.8, the extension=odbc option must be specified in php.ini. I have done testing of ODBC functions on all three versions of PHP on the same computer system. I just reconfigure the Fast CGI module of the IIS web server to switch between PHP versions. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 22:00:01 2025 UTC |
C:\WINDOWS\system32>cd \php740 C:\PHP740>php --ini Configuration File (php.ini) Path: C:\WINDOWS Loaded Configuration File: C:\PHP740\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) C:\PHP740>php -m |findstr odbc C:\PHP740>php -r "odbc_connect();" Fatal error: Uncaught Error: Call to undefined function odbc_connect() in Command line code:1 Stack trace: #0 {main} thrown in Command line code on line 1 C:\PHP740> C:\PHP740>cd \php739 C:\PHP739>php --ini Configuration File (php.ini) Path: C:\WINDOWS Loaded Configuration File: C:\PHP739\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) C:\PHP739>php -m |findstr odbc C:\PHP739>php -r "odbc_connect();" Fatal error: Uncaught Error: Call to undefined function odbc_connect() in Command line code:1 Stack trace: #0 {main} thrown in Command line code on line 1 C:\PHP739> C:\PHP739>cd \php738 C:\PHP738>php --ini Configuration File (php.ini) Path: C:\WINDOWS Loaded Configuration File: C:\PHP738\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) C:\PHP738>php -m |findstr odbc odbc C:\PHP738>php -r "odbc_connect();" Warning: odbc_connect() expects at least 3 parameters, 0 given in Command line code on line 1 C:\PHP738> --PHP script-- <?php if (!function_exists('odbc_connect')) { echo "<br><br><b>Function odbc_connect does not exist!</b><br>\n"; echo "Make sure that php.ini enables extension for odbc.<br>\n"; } else { -------- This error never occurs in 7.3.9RC1 or 7.4.0beta2, only in 7.3.8. Mysterious. The odbc functions work properly (odbc_connect, odbc_prepare, odbc_execute, odbc_num_rows) without php.ini enabled for odbc. It fails if I disable odbc in 7.3.8.This is the PHP script that works without php.ini file. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ODBC Test 5</title> </head> <body> <?php if (!function_exists('odbc_connect')) { echo "<br><br><b>Function odbc_connect does not exist!</b><br>"; echo "Make sure that php.ini enables extension for odbc.<br>"; } else { $exprect_res_cnt = 2; $db_name = "test_db"; $db_table = 'test_info'; echo "<br><br>db name ({$db_name}), db table ({$db_table}), expect <b>res_cnt ({$exprect_res_cnt})</b><br>"; $server = 'djpnet5.dyndns.org'; $dsn = "Driver={MySQL ODBC 8.0 Unicode Driver};Server=$server;Database=$db_name;"; echo "<br><br>ODBC Connector string (<b>{$dsn})</b><br>"; $user = 'root3'; $password = "djp777!123"; $cid = @odbc_connect($dsn, $user, $password); if ($cid) { $qstr = "SELECT * FROM {$db_table}"; $res_id = odbc_prepare($cid, $qstr); if ($res_id) { $res = odbc_execute($res_id); if ($res) { $res_cnt = odbc_num_rows($res_id); echo "<br><br>got <b>res_cnt ({$res_cnt})</b><br>"; } else { echo "<br><br><b>Failed to execute!</b><br>"; } } else { echo "<br><br><b>Failed to prepare!</b><br>"; } } else { echo "<br><br><b>Failed to connect!</b><br>"; echo "Connection string ({$dsn})<br>"; } } ?> </body> </html>