Home > Backend Development > PHP Tutorial > Real PHP multi-threading (not fork or use http to reopen the process)_PHP tutorial

Real PHP multi-threading (not fork or use http to reopen the process)_PHP tutorial

WBOY
Release: 2016-07-13 17:54:26
Original
1182 people have browsed it

[plain]
#If your autoconfig version is higher than 2.59, you can only install php5.4
# Otherwise you can only install 5.3.17. If you know the version of your autoconf - if you have installed php.5.4, then install it according to the installation of 5.4; if you have installed 5.3, install 5.3

#5.4
wget
tar zxvf php-5.4.7.tar.gz
cd php-5.4.7/ext

#5.3
wget
tar -xf php-5.3.17.tar.gz
cd php-5.3.17/ext


#install pthreads below
wget https://github.com/krakjoe/pthreads/tarball/master -O pthreads.tar.gz
tar -xf pthreads.tar.gz
mv krakjoe-pthreads* pthreads
cd ../
./buildconf --force
./configure --enable-maintainer-zts --enable-pthreads --prefix=/usr/local/php-threads#Configure other parameters by yourself, here are only the necessary parameters
make
make install

There are examples in the source code package, execute like this:

/usr/local/php-threads/bin/php AdvancedSynchronization.php

[plain]
Process: running
ScopeTest: 140703850592000 running
ScopeTest2: 140703839512320 running
ScopeTest2: 140703839512320 working ...
ScopeTest2: 140703839512320 notified: 1
Process: notifying 140703839512320: 1
ScopeTest: 140703850592000 notified: 1
Process: notifying 140703850592000: 1

I haven’t tried executing it through apache, because I don’t want to destroy the existing php environment, and I don’t plan to execute it in non-cli mode.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477965.htmlTechArticle[plain] #If your autoconfig version is higher than 2.59, you can only install php5.4 #Otherwise you only 5.3.17 can be installed. If you know the version of your autoconf and if you have installed php.5.4, then you...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template