Using beanstalkd in php

Source: Internet
Author: User
Usrlocals php use beanstalkd process sharing
I. Installation
1. install libevent

Reference

Wget http://cloud.github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz
Cp libevent-1.4.14b-stable.tar.gz/usr/local/src/
Tar zxvf libevent-1.4.14b-stable.tar.gz
Cd libevent-1.4.14b-stable
./Configure -- prefix =/usr/local/libevent
Make
Make install


2. install beanstalkd (this article provides an attachment)

Reference


Cp beanstalkd-1.4.6.tar.gz/usr/local/src/
Tar zxvf beanstalkd-1.4.6.tar.gz
Cd beanstalkd-1.4.6
./Configure -- prefix =/usr/local/beanstalkd
Make
Make install
./Beanstalkd-d-l 127.0.0.1-p 11300


3. for the use of the php client, we recommend that you use the source code instead of the extension method.
Http://sourceforge.net/projects/beanstalk/ Download php client code

Reference


Require ('./BeanStalk. class. php ');
$ Beanstalk = BeanStalk: open (array (
'Servers' => array ('2017. 0.0.1: 100 '),
'Select' => 'randpeek'
));
$ Beanstalk-> use_tube ('Foo ');
$ Beanstalk-& gt; put (0, 0,120, 'Say hello world ');
$ Beanstalk-> watch ('Foo ');
$ Job = $ beanstalk-> reserve_with_timeout ();
Echo $ job-> get (); // Output: 'Say hello world'
Beanstalk: delete ($ job); // Delete the job.
?>

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.