dtczp02204 2014-05-02 21: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 23: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.

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

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行