5
votes

I'm having a difficult time finding out if PHP can connect to an OPC server, and how. Our PHP is running on Unix with an Apache webserver. The OPC server is on Windows, that's the most I know about it at this time. Both servers are on the same network.

Easy on the explanations, please :) I'm used to only using PHP to connect to databases.

Research:
QuickOPC-COM requires a Windows-based server.

Thanks!

3

3 Answers

1
votes

If you can communicate via XML-DC, then you should be able to use the SOAP client in PHP. Check out the WSDL for OPC. I wasn't able to find much documentation, but take a look at this post...

Also, this thread may be of some insight...

1
votes

I have never attempted it using PHP, however I have managed to do it via ASP.NET, would switching to ASP.NET be an option? ASP.NET applications can use DLLs, so providing you have access to a good OPC DLL connection library, you can use it in ASP.NET to communicate. OPC Foundation have one, although you need to be a member to download it. There are various other commercial ones available, plus a very basic free one at http://www.codeproject.com/KB/COM/opcdotnet.aspx (this is the one I used as a proof of concept a few months ago)

While it should be possible via PHP, I think it will be far from easy. PHP does not support COM access due to it being a windows only system. You could reproduce it within PHP, but doing so would be a lot of work.

An alternative may be to write some sort of gateway system either as an ASP.NET service or local program on the same server as the OPC Server, which takes the OPC Data and translates it into a more easy to use format, such as XML or similar.

If you do find a way to do it in PHP, please let me know, as I am primarily a PHP programmer working for a company that specialises in OPC solutions, but am starting to switch to ASP so we can offer a web based solution...

0
votes

There is no good existing framework for accessing OPC DA using PHP. I would look at building some Python scripts using OpenOPC for an access layer.