Socket programming

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sboons
Forum Newbie
Posts: 5
Joined: Thu Oct 29, 2009 3:14 pm

Socket programming

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Socket programming

Post 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.
sboons
Forum Newbie
Posts: 5
Joined: Thu Oct 29, 2009 3:14 pm

Re: Socket programming

Post by sboons »

Thanks a lot. I took your advise and found the problem. Now I am looking for the solution (posted another topic).

THANKS!
Post Reply