A
A
Alexander Gamov2017-11-29 11:08:43
linux
Alexander Gamov, 2017-11-29 11:08:43

Why is the com port blocked when reading from under php and how to enable the dio extension?

It is necessary to work directly with the com port (cashcode bill acceptor), ubuntu 16.04 & php7.1
When you turn on the PC, the first time you access the com port, the com port hangs when you try to read the response. I temporarily fly by launching a third-party program (which works fine with com ports), after it everything works as it should.
or to work with the com port
Helper for the bill acceptor
The controller itself
I read that you can try to read and write to the port through dio, they say, a lower level one.
Installed via pear
sudo pear install channel://pecl.php.net/dio-0.1.0
Registered in the config /etc/php/7.1/fpm/php.ini

extension=dio.so

But I don’t see in phpinfo that the library is connected and php itself swears at
Call to undefined function dio_open()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Gamov, 2017-12-01
@slowdream

Compared through the service the output of the working port config and no, it turned out

stty -F /dev/ttyS0 min 0 -hupcl -icrnl -ixon -isig -icanon -iexten -echo ignbrk noflsh -opost
everything worked

B
Boris Korobkov, 2017-11-29
@BorisKorobkov

extension=dio.so

Are you sure that's the name of the file?
Find it in /usr/lib/php and subfolders
It is more correct to do this in a separate file /etc/php/7.1/fpm/conf.d/dio.ini

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question