PHP Asynchronous Task Processing: Gearman

Source: Internet
Author: User
Tags zts

Gearman is a machine that is used to delegate work to other machines, distributed calls that are better suited for a particular job, and concurrent tasks that load balance among multiple calls.

Preparing packages

Gearmand-1.1.12.tar.gz

gearman-1.1.1.tgz PHP extension

Installing Support components

Yum-y Install boost-devel* gperf* libevent-devel* libuuid-devel*

./configure

Make

Make install

Ldconfig

Installing Gearman

Tar XF gearmand-1.1.12.tar.gz

CD gearmand-1.1.12

./configure--with-php-config=/usr/local/php/bin/php-config

Make

Make install

Installing PHP Extensions

Tar XF gearman-1.1.1.tgz

CD gearman-1.1.1

/usr/local/php/bin/phpize--with-php-config=/usr/local/php/bin/php-config

./configure--with-php-config=/usr/local/php/bin/php-config

Make

Configure Gearman

cp/tools/gearman-1.1.1/modules/gearman.so/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226

Vi/usr/local/php/etc/php.ini

" /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226 " extension="gearman.so"

Service httpd Restart

Start using

Mkdir-p/usr/local/var/log/

Echo ' >/usr/local/var/log/gearmand.log

Gearmand-d

Ps-ef | grep Gearman

Root15045      1  0  +: -?xx:xx:xxGearmand-Droot15053      1  0  +:Wuyi?xx:xx:xxGearmand-Droot15056 112065  0  +: thepts/3    xx:xx:xx grepGearman

/usr/local/php/bin/php -c/usr/local/php/etc/php.ini client.php

/usr/local/php/bin/php -c/usr/local/php/etc/php.ini worker.php

attached: several code examples

Put the code in the Htdocs directory to access worker.php and client.php respectively

It can also be executed under the Linux command line ...

;

PHP Asynchronous Task Processing: Gearman

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.