下面介绍两种编译方式:
1、在已有的PHP上编译pthreads扩展
注:需要动态加载pthreads模块,之前在编译php时必须启用--enable-maintainer-zts;否则需要重新编译PHP。
pthreads源码包下载地址: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、重新编译PHP,加载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 将pthreads解压,移动到php/ext/下,并改名为pthreads;
来到php源码目录
./buildconf --force
./configure --help | grep thread
是否能看到--enable-threads,如果没有则执行:
rm -rf aclocal.m4
rm -rf autom4te.cache/
./buildconf --force
初始化编译配置:
./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
启动php-fpm
/etc/init.d/php-fpm start
测试,查看phpinfo输出
官方文档:http://docs.php.net/manual/en/pthreads.installation.php#113019

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

Notepad++7.3.1
Easy-to-use and free code editor

Dreamweaver Mac version
Visual web development tools
