PHP安裝pthreads多線程擴充教程[windows篇]_PHP教程

來源:互聯網
上載者:User

一、判斷PHP是ts還是nts版

通過phpinfo(); 查看其中的 Thread Safety 項,這個項目就是查看是否是安全執行緒,如果是:enabled,一般來說應該是ts版,否則是nts版。

二、根據PHP ts ts版選擇對應pthreads的版本


本人php版本是5.4.17的所以下載php_pthreads-0.1.0-5.4-ts-vc9-x86.zip檔案包,其中0.1.0表示為當前pthreads版本號碼,5.4為php版本號碼,ts就是之前判斷php對應的ts、nts版,vs9代表是Visual Studio 2008 compiler編譯器編譯的,最後的x86代表的是32位的版本。

三、安裝pthreads擴充

將下載好的php_pthreads-0.1.0-5.4-ts-vc9-x86.zip檔案包解壓得到 pthreadVC2.dll和php_pthreads.dll檔案,把vc2檔案放到php.exe同級目錄,把php_pthreads.dll放到擴充目錄下。 1、修改php.ini檔案 添加extension=php_pthreads.dll
2、修改Apache設定檔httpd.conf 添加LoadFile X:/PHP5/pthreadVC2.dll
3、重啟Apache伺服器

四、測試pthreads擴充

arg = $arg;  }  public function run(){    if($this->arg){      printf(Hello %s, $this->arg);    }  }}$thread = new AsyncOperation(World);if($thread->start())  $thread->join();?>
運行以上代碼得到“HelloWorld”,就說明安裝pthreads擴充成功!

http://www.bkjia.com/PHPjc/735894.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/735894.htmlTechArticle一、判斷PHP是ts還是nts版 通過phpinfo(); 查看其中的 Thread Safety 項,這個項目就是查看是否是安全執行緒,如果是:enabled,一般來說應該是ts版...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.