Home >Backend Development >PHP7 >How to configure serial port connection dio in php7
In php, there is something called a serial port. I don’t know if you have heard of it. Today I will show you how to configure the serial port to connect to dio in php7. You can refer to it if you need it.
Due to project reasons, communication with hardware is required. The customer just said that the serial port would be connected. But I don’t know what a serial port is. I think there should be ready-made software that can handle it. Hey, I’ll come back and do it. It's actually quite troublesome.
After checking, there are currently only these versions of PHP that support serial ports (PHP 4 >= 4.2.0, PHP 5 <= 5.0.5, PHP 7).
Originally I wanted to use 5.6 to add extensions, but seeing that php7 supports it, I didn’t have to worry so much. Directly changed php to 7.
After downloading php7 and configuring the environment, I used the window local machine to test and found that php_dio.dll was missing.
You can only find it. For windows, you can download the dll directly here, http://pecl.php.net/package/dio/0.1.0/windows,
When downloading Remember to look clearly and it must match your own PHP. If you choose thread safety, choose thread safety. If it is not safe, choose unsafe.
After downloading, unzip it and put the two dlls inside into the ext folder in your php folder.
You can also choose other versions for this address.
http://pecl.php.net/package/dio
By the way, after doing it, you can write a code to test it. As for the code, I also read other people’s code. You can go to this address to read it.
http://blog.csdn.net/yuyouwen123456/article/details/20151011
If you don’t have hardware and want to test the serial port, you can download Configure Virtual Serial Port Driver to simulate the serial port, and then use the serial port assistant to send data. This way you can test it on your PC.
Recommended learning: php video tutorial
The above is the detailed content of How to configure serial port connection dio in php7. For more information, please follow other related articles on the PHP Chinese website!