Quantcast
Channel: .NET Framework Setup and Servicing forum
Viewing all articles
Browse latest Browse all 3295

Problem with getting PHP to instantiate .NET object

$
0
0

I'm trying to use the SerialPort class via PHP's DOTNET function thus:

$serial = new DOTNET('System', 'System.IO.Ports.SerialPort');

This says:

PHP Fatal error:  Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified.

It seems that PHP does not work with .NET 4 but I also have 2.0, 3.0 and 3.5 installed on my windows 7 64-bit system, as shown bythis dotnet verifier log file

PHP manual says that I have to use a fully qualified class name with the DOTNET function which they illustrate thusly:

 
$full_assembly_string = 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a8425bc35256e463';
$full_class_name = 'System.Windows.Forms.Form';
$form = new DOTNET($full_assembly_string, $full_class_name);

My problem is that, knowing nothing about .NET, I don't know what the fully qualified class name for System.IO.Ports.SerialPort should be in its .NET 2.0 form. Can anyone help with that?

BTW: I'm using PHP 5.3.6 as a 32-bit application and as a command line utility rather than part of a web server.


Viewing all articles
Browse latest Browse all 3295

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>