By default, the Selenium server accepts commands on the local host 4444
So you can do this:
<?php $selenium_running = false; $fp = @fsockopen('localhost', 4444); if ($fp !== false) { $selenium_running = true; fclose($fp); } var_dump($selenium_running);
I personally don't like using @, but fsockopen insists on throwing a PHP notification when the connection fails. The presence of this warning in the output, or even in the log file, is simply annoying.
source share