1. 程式人生 > >PHP編譯配置安裝pthread多執行緒 全過程

PHP編譯配置安裝pthread多執行緒 全過程

環境和版本:

系統:Centos7.2

mysql:mariadb-10

pthread v3 版本開始只支援cli模式(命令列)執行指令碼,正常啟動都會失敗,pthread阻止的。

以下是作者說明:

SAPI Support

pthreads v3 is restricted to operating in CLI only: I have spent many years trying to explain that threads in a web server just don't make sense, after 1,111 commits to pthreads I have realised that, my advice is going unheeded.

So I'm promoting the advice to hard and fast fact: you can't use pthreads safely and sensibly anywhere but CLI.

Thanks for listening ;)

此文章我挑選了v2來配置!安裝方法和步驟都是相同的。

安裝步驟:

### php

[[email protected]] # wget http://au1.php.net/distributions/php-5.6.36.tar.gz
[[email protected]] # tar -zxvf php-5.6.36.tar.gz
[[email protected]] # cd php-5.6.36
[roo[email protected]] # ./configure --prefix=/usr/local/php56 --with-config-file-path=/usr/local/php56/etc --with-config-file-scan-dir=/usr/local/php56/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fileinfo --enable-opcache --enable-intl --with-xsl  --enable-maintainer-zts

##### 上面配置引數 請修改成自己的mysql路徑

[[email protected]] # make ZEND_EXTRA_LIBS='-liconv'

[[email protected]] # make install

#### 下面是配置php-fpm service方式啟動

[[email protected]] # install -v -m755 sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm56

### pthread

[[email protected]] # wget https://codeload.github.com/krakjoe/pthreads/zip/v2.0.10

[[email protected]] # unzip v2.0.10

[[email protected]] # cd pthreads-2.0.10

[[email protected]] # /usr/local/php56/bin/phpize

[[email protected]] # ./configure --with-php-config=/usr/local/php56/bin/php-config

[[email protected]] # make && make install

在php.ini檔案中加入:

extension=pthreads.so

啟動php-fpm:

service php-fpm56 start

至此安裝配置結束!如有問題可以留言

相關推薦

PHP編譯配置安裝pthread執行 全過程

環境和版本:系統:Centos7.2mysql:mariadb-10pthread v3 版本開始只支援cli模式(命令列)執行指令碼,正常啟動都會失敗,pthread阻止的。以下是作者說明:SAPI Support pthreads v3 is restricted to

linux下用eclipse編譯c++的pthread執行配置

問題:eclipse使用pthread.h遇到“pthread_create”未定義的問題。 解決方法: a.需要在編譯時新增-lpthread引數 $ g++ XXXXX.cpp -lp

PHP安裝pthreads執行擴充套件教程[windows篇]

一、判斷PHP是ts還是nts版 通過phpinfo(); 檢視其中的 Thread Safety 項,這個專案就是檢視是否是執行緒安全,如果是:enabled,一般來說應該是ts版,否則是nts版

PHP安裝pthreads執行擴充套件[windows篇]

一、判斷PHP是ts還是nts版 通過phpinfo(); 檢視其中的 Thread Safety 項,這個專案就是檢視是否是執行緒安全,如果是:enabled,一般來說應該是ts版,否則是nts

PHP安裝threads執行擴充套件基礎教程

一、下載pthreads擴充套件 二、判斷PHP是ts還是nts版 通過phpinfo(); 檢視其中的 Thread Safety 項,這個專案就是檢視是否是執行緒安全,如果是:enabled,一般來說應該是ts版,否則是nts版。 三、根據P

PHP Pthread執行操作

<?php  class vote extends Thread {     public $res    = '';     public $url    = array();     public $name   = '';     public $runing = false;     publi

pthread執行的練習

pthread庫進行多執行緒程式設計 pthread庫的函式: 1、pthread_create(),建立執行緒 原型int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict att

【C++】VS2013配置C/C++執行使用環境

在用C語言做影象處理的過程中,經常會使用到多執行緒操作,對於沒有使用過的朋友們,或許還要折騰半天,今天這裡簡單總結一下配置方法: 1,下載pthread 的windows安裝包:http://sourceware.org/pthreads-win32/  至於版本,

為MPI新增PThread執行支援

如果要在PThread中呼叫MPI,就要為MPI新增PThread支援。如果當前編譯的MPI不支援PThread,那麼在呼叫MPI_Init_thread(&argc,&argv,MPI_THREAD_MULTIPLE, &provided);

Linux GCC 開發入門(4) -- pthread執行 初步 semaphore

多執行緒 是 Linux 程式設計必備。程式設計介面上 自然是支援 最多的 POSIX pthread.  1.執行緒的產生:    pthread_create   可以立刻執行一個  void * thread_func(void *) 的執行緒。 2.執行緒通訊: 互

pthread 執行基礎

本文主要介紹如何通過 `pthread` 庫進行多執行緒程式設計,並通過以下例子進行說明。 + 基於萊布尼茲級數計算 $\pi$ . + 多執行緒歸併排序 參考文章: + [1] https://computing.llnl.gov/tutorials/pthreads ## API 介紹 ###

windows下PHP Pthreads執行安裝配置

一、phpinfo()檢視已安裝php版本是否執行緒安全及編譯器版本 ThreadSafety項enabled表示執行緒安全 Compiler項表示編譯器 二、根據以上資訊及系統版本選擇pthreads版本 pthreads下載地址:http://windows.php.n

Windows下PHP執行擴充套件pthreads的安裝

檢視phpinfo() 複製檔案 複製php_pthreads.dll到D:\wamp\bin\php\php5.5.12\ext\目錄下 複製pthreadVC2.dll到D:\wamp

php執行pthread詳解

**執行緒(thread): 作業系統能夠進行運算排程的最小單元,包含在程序中,是程序的實際運算單位。 一條執行緒指的是程序中一個單一順序的控制流,一個程序中可以併發多個執行緒,每條

windows下安裝php真正的執行擴充套件pthreads教程

擴充套件地址:http://docs.php.net/manual/zh/book.pthreads.php注意事項 php5.3或以上,且為執行緒安全版本。apache和php使用的編譯器必須一致。 通過phpinfo()檢視Thread Safety為enabled則為執行緒安全版。 通過phpinfo(

php 執行 pthreads安裝

Find out what is your ‘PHP Extension Build’ version by using phpinfo(). You can use this - http://localhost/?phpinfo=1 Download

CP2K4.1-release & 最新5.x-development 程序執行(MPI+OPENMP) (psmp版 & popt版)超詳細編譯安裝教程極致優化加速版(全編譯器可編譯版)

CP2K 4.1-release & 最新5.x-development 多程序多執行緒(MPI+OPENMP) (psmp版 & popt版)超詳細編譯安裝教程極致優化加速版(全

ubuntu16.04 安裝 lnmp 及php 執行 初級版本

1 切換為root 帳號登入 2 更新apt-get源為阿里雲的源 :貌似容易出現問題。 3 安裝 nginx :apt-get install nginx 4 安裝 php7 :apt-get install php 5 安裝 mysql :apt-

C++ 執行pthread 學習筆記

本篇是我在學習C++多執行緒的時候做的筆記,主要記錄的是基礎的流程,部分程式碼例項,以及重點函式的說明。 pthread 入口函式型別說明 void * func1(void * t) void* 表示無型別指標 void*作為函式引數,表示函式接收一個指標,不管是什麼型別

c/c++ 執行 ubuntu18.04 boost編譯執行的坑

多執行緒 boost編譯與執行的坑 背景:因為要使用boost裡的多執行緒庫,所以遇到了下面的坑。 系統版本:ubuntu18.04 一,安裝boost 1,去boost官網下載 boost_1_XX_0.tar.gz 2,解壓 tar -zxvf boost_1_65_0.tar.gz 3