Php Serial Port Communication Linux Download

Viewed 645 times

Re: [SOLVED] Serial port dropping bytes The device on the other end is an Atmel xmega microcontroller. I did not use any flow control when I wrote the firmware as the communication routines in the firmware are very fast as the chip runs at 32 MHz and the USART is interrupt driven.

I have installed xampp in fedora 13.I am trying to communicate with microcontroller through serial port using php serial class. My code is example.php. The switch console port is connected to the serial port of my Linux box. How can I connect to the serial port from a Linux terminal? Download this article as ad.

Apr 30, 2012  php serial communication in linux. Arduino Forum > Using Arduino > Programming Questions > php serial communication in. I have installed xampp in fedora 13.I am trying to communicate with microcontroller through serial port using php serial class. My code is example.php(find the attachment).On opening example.php. PHP USB serial port call from Windows to Linux. Up vote 1 down vote favorite. I have a piece of simple code that works on a Windows - WAMP environment, e.g. Try composer require hyperthese/php-serial. The only tiny gotcha is you need to make sure the user/program is able to access the dialout group. Read serial port with PHP is so simple in Linux machine for windows will write another article soon. Just download the read serial port with php script just below. And extract it to your /var/www/html/ folder.

I am building an online POS and trying to establish low level communication with an Epson tm-t88iv thermal printer. there is no direct printing of files, only hexadecimals or ascii can be sent to the hardware in a specific format for it to print. all of this done in a linux enviroment (both ubuntu 13.10 and 12.04).

Now the problem is that I can't establish communication with the printer. I have tried using Jzebra and other java to javascript libraries but with no luck, so I changed to a more familiar environment and tried using the php serial class with a status check code but nothing happens.

which returns an empty string. Also the printer is not receiving the hexadecimals (it is set on a hex-dump state, to print every hex it receives).

I am not sure even if its a coding or hardware problem. I tried installing cutecom to talk with serial port but I don't get any answers either. I also tried doing some stty commands directly from shell but got nothing either.

Hyperterminal

If someone can please shed a light on why this is happening or if he has any similar experience, it would be great.

thanks!

p.d: i am connecting using a prolific pl2303 serial to usb cable and its correctly installed as far as i am aware.

Kumar V
7,9918 gold badges34 silver badges53 bronze badges
BVJBVJ
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.

Browse other questions tagged phplinuxserial-portlow-level or ask your own question.

Active9 years, 2 months ago

I'm trying to port the following small QBASIC program (which works 100%) to PHP:

Currently I'm calling it in its compiled (exe) form from PHP (on WAMP5) but I'd like to get rid of the QBASIC and call it directly from PHP.

I wrote this PHP function but it just hangs at the fgets() line:

}

Reengineering the corporation book. “Reengineering the Corporation” was probably “the most successful business book of the last decade,” so people interested in business management don’t really have the luxury not to read it. However, parts of it are a bit outdated, so be sure to consult the revised edition – and even that with a lot of caution. Who Should Read “Reengineering the Corporation”?

I'm using this PHP line to call the above function:

Any help will be creatly appreciated! I've basically given up trying. If QBASIC can do it perfectly then we must be able to make this work with PHP!

dmp
10.1k6 gold badges33 silver badges46 bronze badges
CJ_CJ_

3 Answers

You might want to look into PHP Serial by Rémy Sanchez. There's an article about it here:

Also have a look at this example provided by jared at dctkc dot com on the PHP site:

MikeMike
18.3k2 gold badges33 silver badges62 bronze badges

Pretty sure PHP has no access to hardware ports by default. It has access to network resources, file resources, but without some kind of transport between the hardware and what you're trying to read, can't see this working.

There may however be a platform specific extension you can load which will enable this - just investigating.

e: Yep, there is - check this extension, might be what you're after. Without something like this, it's just not going to work.

'This extension allows the direct access the parallel and serial(rs232) port in reading and writing by the DLL inpout32.dll under WIN9x/NT/2000/XP for any assembly. An example of concret application: Complete house automation with web interface and php, connection hardware of any nature with the ports like assemblies simple or to complicate. One idea simple but quite practical.. Extension and source was compiled with Delphi 6 for PHP5.0 to 5.1.2, sources and example included.'

dmpdmp
10.1k6 gold badges33 silver badges46 bronze badges

If you're on Linux or other UNX-like system (e.g. Mac OS X), try fopen('/dev/ttyS0') - in UNX, everything is a file, even serial ports. See this for a few tips for finding out which port maps to which 'file'.

PiskvorPiskvor
73.9k41 gold badges159 silver badges210 bronze badges

Linux Serial Port Library

Not the answer you're looking for? Browse other questions tagged phphardware-interfaceqbasic or ask your own question.