查看PHP擴展加載的目錄
php -i | grep extension_dir
Centos下使用yum安裝php默認是都不帶pcntl擴展,需要安裝擴展需要下載安裝包,編譯安裝。
首先查看你的服務器的php版本
php -v
比如我這里php版本是7.2.5
,去官網http://php.net/releases/ 下載對應的安裝包
下載完成之后,解壓
tar zxvf php-7.2.5.tar.gz
進入擴展目錄
cd php-7.2.5/ext/
進入pcntl
擴展目錄
cd pcntl/
編譯安裝
/usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config #注意/usr/bin/php-config 要是你的路徑 make && make install
如果不知道php-config
位置
whereis php-config
安裝完成后提示
Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/lib64/php/modules/
重啟php-fpm
service php-fpm restart
使用命令php -m
查看安裝的擴展, 如果沒有成功,編輯配置文件
vi /etc/php.ini
添加配置
extension=/usr/lib64/php/modules/pcntl.so
文章來源:https://blog.csdn.net/github_26672553/article/details/80675832