Page 1 of 1

Where is PHP PECL DIO?

Posted: Sun Dec 03, 2006 7:59 pm
by timothee
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.

Posted: Sun Dec 03, 2006 8:03 pm
by feyd
The PECL site shows it as currently not available.

Posted: Sun Dec 03, 2006 8:17 pm
by timothee
Hi feyd,

Thanks for your quick reply.
The PECL site shows it as currently not available.
So what can I do about that? Does it mean it is not possible to control the serial port via PHP?

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
));
Is there any alternative to do the above?

Thanks,
Tim.