Page 1 of 1

Socket programming

Posted: Thu Oct 29, 2009 3:22 pm
by sboons
Hello all,

I have a PHP socket script. GPS trackers connect to this socket. IMEI verification takes place and if that is ok, the code is passed to a database. Also if the code contains alert-info, SMS alert is sent to mobile phones.

It works like a charm.. well almost.
My problem is that when I run the script indefinite, after some hours the processor usage exeeds to 99,9% (with top, I can see it is the PHP file which is the cause).

Now my question is: Is it possible to debug the script, so I can find the origin of the CPU usage?

Thanks,
Steef

Re: Socket programming

Posted: Thu Oct 29, 2009 4:16 pm
by requinix
Yes, it's possible to debug PHP scripts (try Google) but debugging this kind of problem is annoying.

Most likely source of the high CPU usage: infinite loop.
Basic debugging technique: use echo/print statements to see what the code is doing.

Re: Socket programming

Posted: Sat Oct 31, 2009 3:57 am
by sboons
Thanks a lot. I took your advise and found the problem. Now I am looking for the solution (posted another topic).

THANKS!