如何在ubuntu 12.10中安装pthread [英] how to install pthread in ubuntu 12.10

查看:939
本文介绍了如何在ubuntu 12.10中安装pthread的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何安装 pthread 的问题,我一直在努力几个小时我的ubuntu服务器允许php线程. 请帮助我.

I have been strugling for hours on how to install pthread in my ubuntu server to allow php threading. Please help me.

推荐答案

如何在LINUX系统中安装:

以下说明将导致PHP的隔离安装,不会影响您当前的安装.

HOW TO INSTALL IN LINUX SYSTEM'S:

The following instructions will result in an isolated installation of PHP that does not affect your current installation.

1)将PHP源检出到系统上的新目录中

1) Checkout PHP sources into a new directory on your system

cd /usr/src
git clone https://github.com/php/php-src
cd php-src

1a)(可选)签出特定版本的PHP

1a) Optionally checkout a specific version of PHP

git checkout PHP-5.6

2)将pthreads源下载到构建目录(/ext)

2) Download the pthreads sources to the build directory (/ext)

cd ext
git clone https://github.com/krakjoe/pthreads
cd ../

3)配置新的隔离PHP安装

3) Configure new isolated PHP installation

./buildconf --force
./configure --prefix=/opt/php-zts \
            --bindir=/opt/php-zts/bin \
            --with-config-file-dir=/opt/php-zts \
            --with-config-file-scan-dir=/opt/php-zts/modules.d/ \
            --enable-pthreads=shared \
            --with-curl=shared,/usr \
            --with-zlib \
            --with-libxml2 \
            --enable-simplexml \
            --with-mysql=mysqlnd \
            --with-pdo-mysql=mysqlnd \
            --enable-gd-native-ttf \
            --with-mysqli \
            --enable-shared \
            --enable-maintainer-zts \
            --enable-sockets \
            --with-curl=shared \
            --enable-mbstring
make -j8
make install
echo "extension=pthreads.so" > /opt/php-zts/modules.d/pthreads.ini

此处使用的configure命令将导致安装带有合理模块的标准安装.如果构建过程失败,那么您应该能够通过安装开发包来解决错误,例如,如果curl模块无法配置或构建,那么

The configure command used here will result in a fairly standard installation with a sensible set of modules. If the build process fails, you should be able to resolve errors by installing developement packages, for example should the curl module fail to configure or build then

yum install curl-devel

或者与您系统等效的选项应该可以解决该错误,并使构建继续进行.

Or the equivalent for your system should resolve the error, allowing the build to continue.

4)将/opt/php-zts/bin中的一些有用的东西符号链接到/usr/local/bin

4) Symlink some useful things in /opt/php-zts/bin to /usr/local/bin

ln -s /opt/php-zts/bin/php /usr/local/bin/php-zts
ln -s /opt/php-zts/bin/phpize /usr/local/bin/phpize-zts
ln -s /opt/php-zts/bin/php-config /usr/local/bin/php-config-zts
ln -s /opt/php-zts/bin/php-cgi /usr/local/bin/php-cgi-zts
ln -s /opt/php-zts/bin/phpdbg /usr/local/bin/phpdbg-zts

此时,您已经可以使用pthreads进行PHP的有效安装(如果没有,则为所选分支或主版本的版本).

At this point you have a working installation of PHP (version of your chosen branch or master if none) with pthreads available.

构建模块的过程如下(以APCu为例):

The procedure for building modules is as follows (APCu used for example):

cd /usr/src
git clone https://github.com/krakjoe/acpu
cd apcu
phpize-zts
./configure --with-php-config=php-config-zts
make -j8
make install
echo "extension=apcu.so" > /opt/php-zts/modules.d/apcu.ini

在构建模块时,必须确保传递正确的php-config路径,因为默认情况下会检测到PHP的系统安装.

You must be sure to pass the correct php-config path when building modules since by default your system installation of PHP will be detected.

所有用引号引起来的命令都可以用于复制粘贴.

这篇关于如何在ubuntu 12.10中安装pthread的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆