下载:

    https://www.php.net/downloads.php
    7.4: https://www.php.net/distributions/php-7.4.4.tar.gz
    7.2: https://www.php.net/distributions/php-7.2.20.tar.gz

配置

./configure \
--prefix=/Users/ysnows/var/php \
--with-config-file-path=/Users/ysnows/var/php/etc \
--enable-fpm \
--with-fpm-user=ysnows  \
--with-fpm-group=admin \
--enable-inline-optimization \
--with-iconv=$(brew --prefix libiconv) \
--enable-opcache \
--with-openssl

编译&&安装

    make && make install

config info

Installing shared extensions:     /Users/ysnows/var/php74/lib/php/extensions/no-debug-non-zts-20190902/
Installing PHP CLI binary:        /Users/ysnows/var/php74/bin/
Installing PHP CLI man page:      /Users/ysnows/var/php74/php/man/man1/
Installing PHP FPM binary:        /Users/ysnows/var/php74/sbin/
Installing PHP FPM defconfig:     /Users/ysnows/var/php74/etc/
Installing PHP FPM man page:      /Users/ysnows/var/php74/php/man/man8/
Installing PHP FPM status page:   /Users/ysnows/var/php74/php/php/fpm/
Installing phpdbg binary:         /Users/ysnows/var/php74/bin/
Installing phpdbg man page:       /Users/ysnows/var/php74/php/man/man1/
Installing PHP CGI binary:        /Users/ysnows/var/php74/bin/
Installing PHP CGI man page:      /Users/ysnows/var/php74/php/man/man1/
Installing build environment:     /Users/ysnows/var/php74/lib/php/build/
Installing header files:          /Users/ysnows/var/php74/include/php/
Installing helper programs:       /Users/ysnows/var/php74/bin/
program: phpize
program: php-config
Installing man pages:             /Users/ysnows/var/php74/php/man/man1/
page: phpize.1
page: php-config.1
/Users/ysnows/var/source/php-7.4.4/build/shtool install -c ext/phar/phar.phar /Users/ysnows/var/php74/bin
ln -s -f phar.phar /Users/ysnows/var/php74/bin/phar
Installing PDO headers:           /Users/ysnows/var/php74/include/php/ext/pdo/

copy php.ini:

cp php.ini.development prefixpath/php.ini 

php.ini guide

; 错误级别
error_reporting = E_STRICT 

php-fpm.conf guide ; pid文件 pid = run/php-fpm.pid

run

php-fpm -F # 前台运行,便于调试
php-fpm -R # root用户运行

stop

kill $(cat ~/var/php74/var/run/php-fpm.pid)