Program worked one day, but after the weekend and a reboot it broke.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Program worked one day, but after the weekend and a reboot it broke.
So I currently have PHP program using PHP serial to send a TAP protocol message to a paging system. The PHP program calls a python program in order to get information from another serial port. This was working on Friday, but then I shutdown the server and went home for the weekend. I came back in today and booted it back up to find my program no longer works. On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.
Does anyone know why my program worked one day but not the other?
Edit:
So I swapped the ports, I had receiver on ttyS0, and pager on ttyUSB0. I swapped these around and edited the program to reflect the swap and everything worked. Anyone know how this solved the problem so don't have to do that swap in the future. It's fine for testing, but not for the final solution.
Last edited by little necro; 09-09-2019 at 07:58 AM.
Reason: Kinda fixed, but what?
So I currently have PHP program using PHP serial to send a TAP protocol message to a paging system. The PHP program calls a python program in order to get information from another serial port. This was working on Friday, but then I shutdown the server and went home for the weekend. I came back in today and booted it back up to find my program no longer works. On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.
Does anyone know why my program worked one day but not the other?
Edit:
So I swapped the ports, I had receiver on ttyS0, and pager on ttyUSB0. I swapped these around and edited the program to reflect the swap and everything worked. Anyone know how this solved the problem so don't have to do that swap in the future. It's fine for testing, but not for the final solution.
Would help to know what the "some error about access denied" was, since that's probably the root cause. Also be helpful to know what version/distro of Linux, PHP, etc.
Would help to know what the "some error about access denied" was, since that's probably the root cause. Also be helpful to know what version/distro of Linux, PHP, etc.
I cannot provide that because I cannot get the error to come back up. I think it is an issue with the configuration on the serial ports. I currently have everything set through the programming.
Accidental working doesn't prove your program being good. So simply you have a problem to solve.
The method to solve the issue was just unplugging the serial port and pluggin it back it, I tested by restarting multiple times to see the result. When I start the server the port will not work with the php program until it has been unplugged and plugged back in.
So if I write a python script that runs at the start and opens the port that is connected to the paging system and then close it everything works as intended. So logically there must be an issue with PHP serials opening of the port for the first time or something that I am missing.
Perhaps I will remove PHP using serial all together then.
Last edited by little necro; 09-09-2019 at 01:03 PM.
I cannot provide that because I cannot get the error to come back up. I think it is an issue with the configuration on the serial ports. I currently have everything set through the programming.
Nothing in the PHP logs??? And version/distro of Linux? PHP????
Quote:
Originally Posted by little necro
The method to solve the issue was just unplugging the serial port and pluggin it back it, I tested by restarting multiple times to see the result. When I start the server the port will not work with the php program until it has been unplugged and plugged back in.
Might be permissions on the device itself, or that the Apache user needs to be added to the tty group.
Quote:
Originally Posted by little necro
So if I write a python script that runs at the start and opens the port that is connected to the paging system and then close it everything works as intended. So logically there must be an issue with PHP serials opening of the port for the first time or something that I am missing. Perhaps I will remove PHP using serial all together then.
It might help knowing the distribution / version you are running.
Without knowing anything about the PHP program, serial port php class or your python script it is impossible to say what is wrong.
At face value /dev/ttyS0 would indicate a hardware device and I find it strange that whatever was connected to it one day would change the next.
Quote:
On Friday I remember I started the GUI and got some error about access denied to the port that talks to the paging system.
Sounds like a permission problem. The typical problem with accessed denied to the port is the user that is trying to access the serial port does not belong to the dialout group. Reconnecting the serial port might mean the device is not being recognized at startup. Check the dmesg output and also check the web server logs if running your php script from a web server.
You do get issues with ports being reserved and reassigned - are devices always guaranteed to be the same number each time? Especially if connections are not closed at the right time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.