Reputation: 708
I'm currently using cURL multi to check thousands of http status codes in a few seconds and it works very well.
However, I'm wondering - is their anyway I can check if a port is responding (e.g. mysql) using cURL or another PHP multitasking method?
Upvotes: 0
Views: 459
Reputation: 47614
The short answer :
The are no threads in PHP.
However, you may take a look to the pcntl extension. It is not about threads, it is fork (that means that a process will be created for each fork).
A Thread extension has been developed some years ago but it has not been updated for 2 years now.
Forks are totally valuable and may be used in your use case however it is not easy to maintain or write. Depending on you needs you may better want to work with python or perl which both have better thread support.
Upvotes: 2
Reputation: 1410
You can use fsockopen()
to scan ports, but each PHP script runs on 1 thread.
http://php.net/manual/en/function.fsockopen.php
Upvotes: 2