You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows10下PHP8.2调用oci_connect连接Oracle19失败求助

PHP oci_connect() 未定义函数问题求助(Windows 10环境)

系统环境与已完成配置

  • 操作系统:Windows 10
  • PHP版本:8.2.11(Win32-vs16-x64),独立安装(未通过XAMPP)
  • Apache环境

已修改php.ini配置:

  1. 设置完整扩展路径:
extension_dir = "C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\ext"
  1. 启用oci8扩展:
extension=oci8_19 

触发的错误

执行以下代码行时(位于C:\\Apache24\\htdocs\\StopCodes\\php\\openDB.php第9行):

$ora = oci_connect($ora_username,$ora_password,$ora_connection_string);

出现致命错误:

Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:\\Apache24\\htdocs\\StopCodes\\php\\openDB.php:9 Stack trace: #0 C:\\Apache24\\htdocs\\StopCodes\\php\\stopCodes.php(3): require() #1 {main} thrown in C:\\Apache24\\htdocs\\StopCodes\\php\\openDB.php on line 9

PEAR安装失败情况

因查阅资料提到PECL需依赖PEAR,尝试安装PEAR:将go-pear.phar复制到PHP目录后执行命令:

C:\\Program Files\\php-8.2.11-Win32-vs16-x64>"c:\program files\php-8.2.11-Win32-vs16-x64\php" go-pear.phar

得到错误输出:

Warning: Private methods cannot be final as they are never overridden by other classes in C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar on line 339
manifest cannot be larger than 100 MB in phar "C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar"
Warning: require_once(phar://go-pear.phar/index.php): Failed to open stream: manifest cannot be larger than 100 MB in phar "C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar" in C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar on line 1284

Fatal error: Uncaught Error: Failed opening required 'phar://go-pear.phar/index.php' (include_path='.;C:\\php\\pear') in C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar:1284
Stack trace:
#0 {main}
  thrown in C:\\Program Files\\php-8.2.11-Win32-vs16-x64\\go-pear.phar on line 1284

已查阅相关旧帖但现有解决方案均无效,目前毫无头绪,恳请帮助。

内容的提问来源于stack exchange,提问作者Mark Ainsworth

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 12:55:33