简体   繁体   English

PHP和Delphi COM + DLL和串行端口

[英]PHP & Delphi COM+ DLL & Serial port

That's my most recent problem... 那是我最近的问题...

I have here some legacy COM+ DLLs that were developed using Delphi 5. One of those DLLs has a method to write stuff on COM Serial ports using the following code: 我这里有一些使用Delphi 5开发的遗留COM + DLL。这些DLL之一具有使用以下代码在COM串行端口上写入内容的方法:

AssignFile(fport,'COM1');
Rewrite(fport);
Write(fport,'some command');
CloseFile(fport);

When we started coding the front end to use PHP, we used a WebService on IIS to access the COM+ DLL. 当我们开始编码前端以使用PHP时,我们在IIS上使用了WebService来访问COM + DLL。 I didn't know then that I could use the COM class in PHP to do it. 当时我不知道我可以在PHP中使用COM类来完成此操作。 But it was working fine. 但它工作正常。

So today I changed the php to use the COM class and got rid of the IIS. 因此,今天我更改了php以使用COM类并摆脱了IIS。 The DLL is called, the function is executed, but the serial port communication does not work at all. 调用了DLL,执行了该功能,但是串行端口通讯根本不起作用。 I tried to put some try..except on Delphi code but no exception is thrown. 我试图把一些try..except放在Delphi代码上,但是没有抛出异常。

Maybe is something related to privileges that php process doesn't have to access the serial port? 也许与php进程不必访问串行端口的特权有关?

Thanks in advance for any clue! 预先感谢您提供任何线索!

The DLL was registered on the machine using regsvr32 and there was the error. 使用regsvr32在计算机上注册了DLL,并且出现错误。 I installed it into the Component Services and everything is OK now. 我将其安装到组件服务中,现在一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM