Installing PHP extensions pthreads implementing PHP Multithreading

Source: Internet
Author: User
Tags php multithreading zts
Here are two ways to compile:


1. Compiling pthreads extensions on existing PHP

Note: You need to dynamically load the Pthreads module, you must enable--ENABLE-MAINTAINER-ZTS before compiling PHP, otherwise you will need to recompile PHP.

Pthreads Source Package Download Address: http://pecl.php.net/package/pthreads


Tar XF pthreads-1.0.0.tgz

CD pthreads-1.0.0

Phpize

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

Make && make install


2. Recompile php, load pthreads


Tar XF php-5.5.8.tar.gz

Tar XF pthreads-1.0.0.tgz

MV pthreads-1.0.0 Php-5.5.8/ext/pthreads will pthreads decompression, move to php/ext/, and renamed to Pthreads;


Come to PHP source directory

./buildconf--force

./configure--help | grep thread

Whether you can see--enable-threads, if not, execute:


RM-RF ACLOCAL.M4

RM-RF autom4te.cache/

./buildconf--force

Initialize the compilation configuration:

./configure--prefix=/usr/local/php--enable-opcache--with-config-file-path=/etc--with-mysql=mysqlnd-- With-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--enable-fpm--enable-pthreads--enable-fastcgi--enable-static-- Enable-inline-optimization--enable-sockets--enable-wddx--enable-zip--enable-calendar--enable-bcmath-- Enable-soap--with-zlib--with-xmlrpc--enable-mbstring--without-sqlite--with-curl--enable-ftp--with-mcrypt-- with-freetype-dir=/usr/local/freetype.2.1.10--with-jpeg-dir=/usr/local/jpeg.6--with-png-dir=/usr/local/ libpng.1.2.50--disable-ipv6--disable-debug--with-openssl--enable-maintainer-zts--disable-safe-mode-- Disable-fileinfo


Make && make install


CP Php.ini-production/etc/php.ini


Install-v-m755./php-5.5.7/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm


Start PHP-FPM

/ETC/INIT.D/PHP-FPM start


Test, view phpinfo output

Official Document: http://docs.php.net/manual/en/pthreads.installation.php#113019

  • 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.