Search code examples
phpcentostask-queuegearman

How to install Gearman Job Server with PHP


I am trying to install Gearman client worker on Centos server. PHP has been installed and all required gearman-php module also installed. when executing command gearmand -d it gets executed successfully.

But when myClientProgram.php assign job to the worker it throws warning:

[Thu Oct 06 03:47:26.293204 2022] [:error] [pid 20990] [client 202.173.125.72:6049] PHP Warning:  GearmanClient::addServer(): 127.0.0.1:4730:4730 getaddrinfo:Name or service not known pid(20990) in /gearman/gearmanManager.class.php on line 28
[Thu Oct 06 03:47:26.293359 2022] [:error] [pid 20990] [client 202.173.125.72:6049] PHP Warning:  GearmanClient::doBackground(): _client_run_task(GEARMAN_NO_SERVERS) no servers provided -> libgearman/run.cc:68: pid(20990) in /gearman/gearmanManager.class.php on line 32

When I try to print error using PHP's error_get_last I get below message:

[message] => GearmanClient::doBackground(): _client_run_task(GEARMAN_NO_SERVERS) no servers provided -> libgearman/run.cc:68: pid(20989)

And when I check status of assigned job using command: gearadmin --status | sort -n | column -t nothing gets displayed only one "dot" display in output of above command.

How can I solve this issue? I have gone through many similar questions but not able to find any solution which could work for me.


Solution

  • credit for this solution to be given to my friend, he has asked me to run two commands:

    getenforce
    setenforce 0
    

    Post that all my mentioned error vanished.