如何在 php.ini 中启用 oci8 (Oracle) 的扩展 - PHP 警告:PHP 启动:在第 0 行未知
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21249858/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable extensions for oci8 (Oracle) in php.ini - PHP Warning: PHP Startup: in Unknown on line 0
提问by programmer
I have Windows XP and recently I installed wamp (apache-mysql-php) 32-bit. I tested the installation (connect to mysql database with php and apache) and everything was working fine.
我有 Windows XP,最近我安装了 wamp (apache-mysql-php) 32 位。我测试了安装(使用 php 和 apache 连接到 mysql 数据库),一切正常。
Now i need to connect to an Oracle database so I tried to enable some extensions related to Oracleand oci8.
现在我需要连接到 Oracle 数据库,所以我尝试启用一些与Oracle和oci8相关的扩展。
And I did:
我做到了:
1)I opened php.inifile and I removed the semicolons before the following lines:
1)我打开了php.ini文件,并删除了以下几行之前的分号:
before:
前:
;extension=php_oci8.dll
;extension=php_oci8_11g.dll
after:
后:
extension=php_oci8.dll
extension=php_oci8_11g.dll
2)I restarted apache and all Services and i get a
2)我重新启动了apache和所有服务,我得到了
- "PHP StartUp" Warning.
- “PHP 启动”警告。
3)In php_error.logfile I get:
3)在php_error.log文件中,我得到:
**PHP Warning: PHP Startup: in Unknown on line 0**
So, i thought that it would be a good idea to check where my extension php folder is and if those dll files are there.
所以,我认为检查我的扩展 php 文件夹在哪里以及这些 dll 文件是否在那里是个好主意。
In php.inimy extension folder is located at:
在php.ini 中,我的扩展文件夹位于:
extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"
The folder exists and both of these libraries (php_oci8.dll php_oci8_11g.dll) are inside that folder.
该文件夹存在并且这两个库 (php_oci8.dll php_oci8_11g.dll) 都在该文件夹中。
4)I added in my 'Path' system variable in Windows the following:
4)我在 Windows 的“路径”系统变量中添加了以下内容:
C:\wamp\bin\php\php5.4.16\ext;
5)I copied both of these dll files in Apache's folder but again it didn't work!
5)我将这两个 dll 文件都复制到了 Apache 的文件夹中,但它再次不起作用!
C:\wamp\bin\apache\Apache2.4.4\bin
6)Also, I checked the phpinfopage and the only entry I get for "oci8" is the following:
6)另外,我检查了phpinfo页面,我得到的“oci8”的唯一条目如下:
Configure Command
配置命令
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared"
Hm...the following folders do not existin my system:
嗯...我的系统中不存在以下文件夹:
C:\php-sdk\oracle\instantclient10\sdk
C:\php-sdk\oracle\instantclient11\sdk
So, what am I supposed to do next in order to correctly enable the oci8 extensions?
那么,接下来我应该怎么做才能正确启用 oci8 扩展?
thanks
谢谢
回答by programmer
[SOLVED]
[解决了]
I downloaded the Instant Client Package - Basic (version 10.2.0.5) and I extracted it.
我下载了 Instant Client Package - Basic(版本 10.2.0.5)并解压了它。
Afterwards I copied all the files of that package in the following folders:
之后,我将该包的所有文件复制到以下文件夹中:
C:/wamp/bin/php/php5.4.16/ext/
C:/wamp/bin/apache/Apache2.4.4/bin
It worked for me in this way. After that the oci8 module was loaded.
它以这种方式对我有用。之后,oci8 模块被加载。
回答by user3596663
When downloading the instantclient, verify that architecture have installed wamp.
下载 Instantclient 时,请验证架构是否已安装 wamp。
In my case instantclient to download the x64 but had installed the x32 and had problems.
在我的情况下, Instantclient 下载 x64 但已经安装了 x32 并且有问题。
Downloaded the correct architecture and it worked fine.
下载了正确的架构,它运行良好。

