0

Guys,

for the below code, I am getting an error which says "Function Not Defined". I am unable to get what should I include to make it run. help will be really helpful.

<?php
$fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK);
dio_close($fd);
?>
Amlan
  • 129
  • 1
  • 2
  • 14

2 Answers2

1

Check your php version with phpinfo(), dio_open is only available for

(PHP 4 >= 4.2.0, PHP 5 <= 5.0.5, PHP 7)

as said in the documentation

if your version doesn't support it, you should update your PHP installation

logut
  • 23
  • 6
  • PHP Version is 5.5. Any solution for that? – Amlan Jun 24 '16 at 09:43
  • if PHP version is 5.5 you have to downgrade to PHP <= 5.0.5 or preferably upgrade to PHP 7 If you have root acces on the server just install php7 using your package manager else you have to ask your hosting provider to update – logut Jun 24 '16 at 10:29
0

As you are using *nix (I guess :) ), you could use the fopen command as stated in this answer: https://stackoverflow.com/a/14540953/1898458 (you will need to set up the port though)

Community
  • 1
  • 1
Flo
  • 26
  • 5