dtczp02204 2014-05-02 13:09
浏览 131
已采纳

具有共享驱动器或UNC的系统环境变量PATH

I am in the process of enabling OCI8 for PHP to be used with Apache.

I have been getting errors similar to:

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php-5.5\ext\php_oci8.dll'

Fatal error: Call to undefined function oci_connect() in ...



So Far

I have set my System Environment Variable PATH to include the paths containing php, php ext, and my instantclient for oracle (worth noting that the instantclient files are on a network shared drive).

Then, I used Process Monitor to see exactly what is going on when Apache loads and i found the lines concerning OCI.DLL (part of the oracle client).


Process Monitor shows:
OCI.dll is not being loaded. Each attempt at loading it shows the file not being found with the "result" column showing "NAME NOT FOUND"
OCI.dll is being looked for within each of the PATH variable paths EXCEPT for my shared drive location, which in this case is Q:/something/something...
I thought this was a bit odd so I changed the "Q" to use a UNC path (knowing that system environment variables do not officially support UNC path). When I checked it again with Process Monitor, it showed that it was looking for OCI.dll in the UNC path but it comes back as "ACCESS DENIED" (but I can access, edit, and delete the file myself).


Summary from Process Monitor:

C:/something/...

Checks each one of my directories IN THE ORDER they are listed in the PATH variable (but none of them contain OCI.dll, as expected).

Q:/something/...

Does not even show up as looking within this directory. I have multiple Q drive paths in my PATH variable and none of them shows up in Process Monitor as being checked.

\\someserver\something\...

Shows up as a record in Process Monitor but the "result" column comes back as "ACCESS DENIED"


Question

  • Why does it not use the PATH locations when the drive letter is associated with a network shared drive? (I have used the same exact path setting to enable the use of the same exact instantclient files for use with VBA and it worked just fine)
  • Why does it tell me that it cannot access the file in the UNC path when I have read/write access to the files?

展开全部

  • 写回答

1条回答 默认 最新

  • douju8113 2014-07-19 15:21
    关注

    If you are running Apache as a service then, by default, it runs as NT AUTHORITY\SYSTEM, not the currently logged in user. The rest of my answer follows this assumption.

    OCI.dll is not being loaded. Each attempt at loading it shows the file not being found with the "result" column showing "NAME NOT FOUND" OCI.dll is being looked for within each of the PATH variable paths EXCEPT for my shared drive location, which in this case is Q:/something/something...

    Q: is a mapped drive for your user account, not the SYSTEM account, so as far as Apache is concerned that path doesn't exist at all.

    I thought this was a bit odd so I changed the "Q" to use a UNC path (knowing that system environment variables do not officially support UNC path). When I checked it again with Process Monitor, it showed that it was looking for OCI.dll in the UNC path but it comes back as "ACCESS DENIED" (but I can access, edit, and delete the file myself).

    By using a UNC path the local SYSTEM account can now see the location but is not authorised to it, hence the ACCESS IS DENIED message.

    So the answer to both of your questions is that the account being used to run Apache is not your user account and doesn't have the same environment settings and access rights.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥45 字符串操作——数组越界问题
  • ¥15 Loss下降到0.08时不在下降调整学习率也没用
  • ¥30 怎么把PCK、OKS指标添加到yolov11中
  • ¥15 QT+FFmpeg使用GPU加速解码
  • ¥15 为什么投影机用酷喵播放电影放一段时间就播放不下去了?提示发生未知故障,有什么解决办法吗?
  • ¥15 来个会搭建付费网站的有偿
  • ¥100 有能够实现人机模式的c/c++代码,有图片背景等,能够直接进行游戏
  • ¥20 校园网认证openwrt插件
  • ¥15 以AT89C51单片机芯片为核心来制作一个简易计算器,外部由4*4矩阵键盘和一个LCD1602字符型液晶显示屏构成,内部由一块AT89C51单片机构成,通过软件编程可实现简单加减乘除。
  • ¥15 求GCMS辅导数据分析
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部