December 08, 2019, 05:22:51 am

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


Using serial with PHP

Started by Curious, August 21, 2013, 05:28:06 pm

Previous topic - Next topic

Curious

Hello every one,
i need to create a web-server on my cubieboard, and i want to connect to a micro-controller with serial.
how could i access gpio and serial in php? is there any way? (like the way in python)

tnx all  :)

patwood

Quote from: Curious on August 21, 2013, 05:28:06 pm
Hello every one,
i need to create a web-server on my cubieboard, and i want to connect to a micro-controller with serial.
how could i access gpio and serial in php? is there any way? (like the way in python)

tnx all  :)

Any way you can use a python CGI or call Python from php via system?  You could use php file operators to read and write gpio files in /sys, but I don't know whether you can use select/poll to wait for a pin state change.  Also, serial devices can be accessed from php via /dev/ttyS*, but python has classes for managing serial features like baud rate and flow control.  I don't know whether php has anything like that.

Curious

Uhu...
so i think the best way is to do it with python and calling python in php  :)

i should search it  8)

tanx for answering

Curious

there is i found a php serial library. is it working on Cubie?

tanx

giovanni.v

Quote from: Curious on August 31, 2013, 06:11:37 am
there is i found a php serial library. is it working on Cubie?


Why not? Php knows little about the processor architecture... luckily, and unlike many other arm targets, serial devices are named ttySx like on x86.
I think it will work, providing you have a free serial where the linux init not started a console.

Seem to me that the source available here is more updated:
- http://code.google.com/p/php-serial/