Hi all,
I need to install the PHP DIO extension to control a device on the serial port with PHP (I'm using PHP 5.1.6-r6 on Gentoo 2006.1). The PHP docs says DIO was moved to PECL in PHP >= 5 but I cannot find a gentoo pecl-dio package in portage and attempting a direct pecl install (pecl install dio) tells me no such package exists.
What should I do to get PHP DIO running?
Thanks in advance,
Tim.
Where is PHP PECL DIO?
Moderator: General Moderators
Hi feyd,
Thanks for your quick reply.
I was thinking of accessing /dev/ttyS0 directly as a file, but it doesn't work. I need to set up the conection attributes first and as far as I can see only the dio functions can let me do that. Below is what I need to use:
Is there any alternative to do the above?
Thanks,
Tim.
Thanks for your quick reply.
So what can I do about that? Does it mean it is not possible to control the serial port via PHP?The PECL site shows it as currently not available.
I was thinking of accessing /dev/ttyS0 directly as a file, but it doesn't work. I need to set up the conection attributes first and as far as I can see only the dio functions can let me do that. Below is what I need to use:
Code: Select all
$fd = dio_open('/dev/ttyS0', O_WRONLY | O_NOCTTY | O_NONBLOCK);
dio_fcntl($fd, F_SETFL, O_SYNC);
dio_tcsetattr($fd, array(
'baud' => 2400,
'bits' => 8,
'stop' => 1,
'parity' => 0
));Thanks,
Tim.