Tips: Gearman connect error “Failed to send server-options packet” in PHP

Gearman flow chart

After running a simple PHP Gearman client script, it throws the error below:

PHP Warning: GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:429 in /home/work/public_html/site/gearman_client.php on line 14

Solution:

The default host and port of Gearman is “localhost” and 4730 respectively. Normally you don’t need to mention it explicitly according to the documentation. But apart from the documentation, I had to explicitly mention it in both client and worker script to make it work.

$worker->addServer(“localhost”,4730);

Ref: You might also want to look into this post.

Sample Worker script: (/usr/bin/php ./gearman_worker.php)

I’ll add a more complete example script later.

Hope, it’ll help someone!

Thanks!

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar

About Me

MurshedVi Die hard coder, Unix server admin, Open source enthusiast, Localization guru, PHP expert, Apache-Solr ecosystem expert, Web geek. The wounded coder, determined not to stop before killing all bugs!! The samurai, bug hunter willing to create a bug free world for all humans!! Great Team player (always watch & cover the back of others). Extra Patience (to dig the root of every single bugs). Ultra Passionate (caring about the products I built). Perfectionist, Proactive, Collaborative, Good listener, Observer, Thinker, thoughtful to serve the better, best, awesome user experience for all netizens. Do you have a tech challenge? Drop a mail to khan.morshed@gmail.com

Oops! It looks like you haven't imported any lists yet. You must import at least one list to use the Easy MailChimp widget.