当前位置:   article > 正文

Install or enable PHP‘s pcntl extension._install or enable php's pcntl extension

install or enable php's pcntl extension

问题原因:

laravel项目执行 composer install时报错,报错信息如下:

  1. Installing dependencies from lock file (including require-dev)
  2. Verifying lock file contents can be installed on current platform.
  3. Your lock file does not contain a compatible set of packages. Please run composer update.
  4. Problem 1
  5. - hhxsv5/laravel-s is locked to version v3.7.0 and an update of this package was not requested.
  6. - hhxsv5/laravel-s v3.7.0 requires ext-pcntl * -> it is missing from your system. Install or enable PHP's pcntl extension.
  7. To enable extensions, verify that they are enabled in your .ini files:
  8. - /etc/php.ini
  9. You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
  10. Alternatively, you can run Composer with `--ignore-platform-req=ext-pcntl` to temporarily ignore these required extensions.

google 结果:Process Control support in PHP is not enabled by default. You have to compile the CGI or CLI version of PHP with --enable-pcntl configuration option when compiling PHP to enable Process Control support.

大意就是这个配置默认是不被开启的,需要在编译php的时候使用 --enable-pcntl 参数开启

https://www.php.net/releases/网站下载7.3.22版本源码在本地mac上编译,结果编译过程报错;后续原因没有继续追查,感觉以目前认知解决比较困难;

因此整理了一下比较不需要底层信息的解决方式:

仅针对mac 且 php version = 7.3

具体操作如下:

1.使用brew search php 查找brew 支持的php版本

2.执行brew install php@7.3

        如果执行报错:那么google php 第三方brew资源库

        执行brew tap shivammathur/php

        重新brew search

        注:shivammathur/php 是我当时搜到的可用的资源

3.将brew install 之后的php@7.3添加到环境变量中

        export PATH="/usr/local/opt/php@7.3/bin:$PATH"

        export PATH="/usr/local/opt/php@7.3/sbin:$PATH"

        export LDFLAGS="-L/usr/local/opt/php@7.3/lib"

        export CPPFLAGS="-I/usr/local/opt/php@7.3/include"

4.使用php -v验证添加之后的php版本信息

5.再次执行composer install显示成功

其中遇到的问题:使用这个第三方库安装php@7.0 直接执行php命令报错;安装php@7.3可用

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/780964
推荐阅读
相关标签
  

闽ICP备14008679号