Jump to content

Recommended Posts

I wonder if this topic is allow to be here , if it is not I'm so sorry for this post and please move or delete it.

 

I need to use php to connect to COM port , I googled it and there are few ways to do it , such as fopen() or dio_open() using php_dio.dll etc.

I tried both methods but it still can't works .

 

The errors I get always:

 

dio_open()[function.dio_open]:cannot open file COM36:with flags 2 and permissions 0: Invalid argument ****....

 

or

 

Warning:fopen(COM36:)[function.fopen]:failed to open stream:Invalid argument in *****....

Fatal error:uncaught exception 'Exception' with message 'Unable to open port "COM36" in *****....

 

Can I get some help for this problem? Thanks for every reply .

Link to comment
https://forums.phpfreaks.com/topic/247726-php-connect-to-serial-port/
Share on other sites

We have had this question in the past, and afaik, php-dio is the only way to get read/write serial port communication working on windows.  Read the manual page carefully, as there are version requirements: 

 

http://us2.php.net/manual/en/book.dio.php

 

This article has a wrapper and working implementation you can use as a basis for your project:  http://blog.950buy.com/article/php-use-rs232-serial-communication-to-send-file/

 

Thanks for your links gizmola , so should I install this package? http://pecl.php.net/package/dio

I already added php_dio.dll into ext folder and add "extension=php_dio.dll" in php.ini , but it still can't works .

 

I'm using PHP 5.2.6 , Apache 2.2.17 , Window Vista .

 

Sorry if my question is stupid.. I'm just a newbie in php...

 

Thanks again .

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.