怎樣在Ubuntu下開啟PHP的pnctl進程管理擴充

來源:互聯網
上載者:User

Howto: Enable PCNTL in Ubuntu PHP installations

怎樣啟用Ubuntu(deb包)安裝PHP的PCNTL

PCNTL in PHP allows for some handy advanced “trickery” using the OS process functions inherent in Linux (*nix?).  I believe some features are available in Windows, but I know for certain that pcntl_fork() is not.

Anyway, it is not enabled by default, so if you want to take advantage of the functions on your Ubuntu LAMP server, you might spend hours searching the web for that magic aptitude command.  But, as far as I can tell, it doesn’t exist.

Luckily, I stumbled across this article on the Ubuntu forums, so I’m dedicating a post here with the hopes that other will find it more easily.

Please note that you’ll probably need build-essentials and a few other source compilation basics, but as long as you have that, the following code will get you what you want.

First, in your home directory:
上面大致介紹了PNCTL的好處,但是預設在linux下是沒有啟用這個功能的,在這裡作者使用的是Ubuntu下的LAMP安裝,通過一下過程就可以開啟需要的功能

mkdir php
cd php
apt-get source php5
cd php5-(WHATEVER_RELEASE)/ext/pcntl
phpize
./configure
make
Then:

cp modules/pcntl.so /usr/lib/php5/WHEVER_YOUR_SO_FILES_ARE/

拷貝so檔案到php5的擴充目錄

echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini

修改設定檔,在deb安裝的環境下擴充配置是都是獨立的檔案

FYI: “make install” does not appear to put the files in the correct place.
可能使用make install並不能拷貝檔案到php擴充目錄,經過測試是可以的,如果是普通使用者,需要使用sudo來執行。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.