我有一台运行Apache 2.2的Windows XP Pro服务器,它配置了指向UNC网络路径的Alias / p(// server / projects)。 Apache在用户Apache下运行,Apache(作为之前的一些故障排除的一部分)是Administrators组的成员。 我碰巧写了一篇博文[此处](http://kromey.us/2009/09/apache-on-windows-serving-files-from-the-network-150.html),如果您需要更多详细信息,请详细说明设置。
I have a Windows XP Pro server running Apache 2.2, which is configured with an Alias /p that points to a UNC network path (//server/projects). Apache runs under the user Apache, which (as part of some previous troubleshooting) is a member of the Administrators group. I happen to have written up a blog post [here](http://kromey.us/2009/09/apache-on-windows-serving-files-from-the-network-150.html) that details the setup if you want more detail.
这个Apache服务器运行一个PHP应用程序,除其他外,需要访问服务器的串行端口(如果你必须知道,它是一个POS应用程序,是的,我完全清楚Web应用程序不是 这里理想的方法 - 不是我的电话)。 这可以从运行C驱动器的PHP脚本中正常工作,但是生活在网络服务器上的脚本似乎无法访问服务器的硬件。
This Apache server runs a PHP application that, among other things, needs to access the server's serial ports (if you must know, it's a POS application, and yes I'm fully aware that a web app is not the ideal approach here -- wasn't my call). This works just fine from PHP scripts running off of the C drive, but scripts that live on the network server do not appear to have access to the server's hardware.
访问串口的方式如下:
Accessing the serial ports is done like so:
《?php
$fh = fopen('com3', 'w+');
fwrite($fh, $data_to_send);
同样,对于存在于C驱动器上的文件也可以正常工作,但UNC路径上的相同文件无法正常工作。
Again, works just fine for files that live on the C drive, but identical files on the UNC path don't work.
我需要找到一个解决方案,允许这些PHP脚本对硬件具有相同的访问权限,无论它们是在C驱动器上还是从网络共享中提取。
I need to find a solution that will allow these PHP scripts the same access to the hardware whether they're on the C drive or pulled from a network share.
_其他信息:_
_Additional information:_
* 这是VirtualBox中的VM; 网络共享实际上是一个VirtualBox共享文件夹,它实现为SMB网络共享。 完全读/写访问权限,适用于除此之外的所有内容。
* 服务器的安全性不受关注 - 这是一个开发/测试设置,它位于3个不同的防火墙和NAT层(私有LAN内的专用LAN内的私有LAN)后面,完全无法通过任何访问它 他们。
* PHP配置为CGI而不是Apache模块(不是我可以改变的,因为这是这个应用程序的部署方式); 尽管如此,它确实也在Apache用户下运行。
* This is a VM in VirtualBox; the network share is in fact a VirtualBox Shared Folder, which is implemented as a SMB network share. Full read/write access, and works for everything except this one thing.
* Security of the server isn't a concern -- this is a dev/testing setup that is behind 3 distinct firewalls and NAT layers (a private LAN within a private LAN within a private LAN) with absolutely no access to it through any of them.
* PHP is configured as CGI rather than an Apache module (not something I can change, since this is how this app is deployed); nonetheless, it does run under the Apache user as well.