Real PHP Multithreading (not fork or re-process with http ). [Plain] # if your autoconfig version is later than 2.59, you can only install php5.4 # otherwise you can only install 5.3.17. If you know your autoconf version, if you have installed php.5.4, you [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 already installed php.5.4, you will install it as 5.4; if you have installed 5.3, you will 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 # Other parameters are configured by yourself. here is only a required parameter
Make
Make install
An example is provided in the source code package, as shown in the following code:
/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: policying 140703839512320: 1
ScopeTest: 140703850592000 notified: 1
Process: policying 140703850592000: 1
I haven't tried apache execution yet, because I don't want to destroy the existing php environment, and I don't plan to execute it in non-cli mode.
Composer # 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 your autoconf version, if you have installed php.5.4, you...