1. 系统环境的php版本为
PHP 7.1.33 (cli) (built: Jan 26 2020 22:52:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
2. 现安装php8.0
megumikichikus-MacBook-Pro:~ xxxx$ sudo port install php
Password:
---> Computing dependencies for php
The following dependencies will be installed:
argon2
gsed
mhash
pcre2
php80
php_select
Continue? [Y/n]: y
……….
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
---> Some of the ports you installed have notes:
php80 has the following notes:
To customize php80, copy /opt/local/etc/php80/php.ini-development (if this is a development server) or /opt/local/etc/php80/php.ini-production (if this is a production server)
to /opt/local/etc/php80/php.ini and then make changes.
3. —————————设置php.ini——————————
megumikichikus-MacBook-Pro:~ xxxx$ cd /opt/local/etc/php80
megumikichikus-MacBook-Pro:php80 xxxx$ sudo cp php.ini-production php.ini
设置系统原版本7.1.33的配置文件,
megumikichikus-MacBook-Pro:~ xxxx$ sudo cp /etc/php.ini.default /etc/php.ini
4. 演示卸载清除port安装的php,
megumikichikus-MacBook-Pro:~ xxxx$ sudo port uninstall --follow-dependencies php
---> Deactivating php @8.0_0
---> Cleaning php
---> Uninstalling php @8.0_0
The following dependencies will be uninstalled:
php80 @8.0.12_0+libedit
argon2 @20190702_1
gsed @4.8_0
mhash @0.9.9.9_1
pcre2 @10.37_0
php_select @1.0_0
pkgconfig @0.29.2_0
再安装,
megumikichikus-MacBook-Pro:~ xxxx$ sudo port install php
---> Computing dependencies for php
The following dependencies will be installed:
argon2
gsed
mhash
pcre2
php80
php_select
pkgconfig
Continue? [Y/n]: ---> Fetching archive for argon2
---> Attempting to fetch argon2-20190702_1.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/argon2
---> Attempting to fetch argon2-20190702_1.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/argon2
---> Installing argon2 @20190702_1
---> Activating argon2 @20190702_1
---> Cleaning argon2
---> Fetching archive for gsed
---> Attempting to fetch gsed-4.8_0.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/gsed
---> Attempting to fetch gsed-4.8_0.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/gsed
---> Installing gsed @4.8_0
---> Activating gsed @4.8_0
---> Cleaning gsed
---> Fetching archive for mhash
---> Attempting to fetch mhash-0.9.9.9_1.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/mhash
---> Attempting to fetch mhash-0.9.9.9_1.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/mhash
---> Installing mhash @0.9.9.9_1
---> Activating mhash @0.9.9.9_1
---> Cleaning mhash
---> Fetching archive for pcre2
---> Attempting to fetch pcre2-10.37_0.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/pcre2
---> Attempting to fetch pcre2-10.37_0.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/pcre2
---> Installing pcre2 @10.37_0
---> Activating pcre2 @10.37_0
---> Cleaning pcre2
---> Fetching archive for php_select
---> Attempting to fetch php_select-1.0_0.darwin_18.noarch.tbz2 from http://mse.uk.packages.macports.org/php_select
---> Attempting to fetch php_select-1.0_0.darwin_18.noarch.tbz2.rmd160 from http://mse.uk.packages.macports.org/php_select
---> Installing php_select @1.0_0
---> Activating php_select @1.0_0
---> Cleaning php_select
---> Fetching archive for pkgconfig
---> Attempting to fetch pkgconfig-0.29.2_0.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/pkgconfig
---> Attempting to fetch pkgconfig-0.29.2_0.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/pkgconfig
---> Installing pkgconfig @0.29.2_0
---> Activating pkgconfig @0.29.2_0
---> Cleaning pkgconfig
---> Fetching archive for php80
---> Attempting to fetch php80-8.0.12_0+libedit.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/php80
---> Attempting to fetch php80-8.0.12_0+libedit.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/php80
---> Installing php80 @8.0.12_0+libedit
---> Activating php80 @8.0.12_0+libedit
---> Cleaning php80
---> Fetching archive for php
---> Attempting to fetch php-8.0_0.darwin_18.noarch.tbz2 from http://mse.uk.packages.macports.org/php
---> Attempting to fetch php-8.0_0.darwin_18.noarch.tbz2.rmd160 from http://mse.uk.packages.macports.org/php
---> Installing php @8.0_0
---> Activating php @8.0_0
---> Cleaning php
---> Some of the ports you installed have notes:
php80 has the following notes:
To customize php80, copy /opt/local/etc/php80/php.ini-development (if this is a development server) or /opt/local/etc/php80/php.ini-production (if this is a production server)
to /opt/local/etc/php80/php.ini and then make changes.
5. 安装 php80-cgi
megumikichikus-MacBook-Pro:~ xxxx$ sudo port install php80-cgi
---> Computing dependencies for php80-cgi
---> Fetching archive for php80-cgi
---> Attempting to fetch php80-cgi-8.0.12_0.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/php80-cgi
---> Attempting to fetch php80-cgi-8.0.12_0.darwin_18.x86_64.tbz2.rmd160 from http://mse.uk.packages.macports.org/php80-cgi
---> Installing php80-cgi @8.0.12_0
---> Activating php80-cgi @8.0.12_0
---> Cleaning php80-cgi
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
---> Some of the ports you installed have notes:
php80-cgi has the following notes:
If this is your first install, you need to enable php80-cgi in your web server.
安装完成后,在 /opt/local/bin/目录下,多了php-cgi80
phpstorm ——> Please ensure that configured PHP Interpreter built as CGI program (--enable-fastcgi was specified)
phpstorm找不到cgi,所以执行
megumikichikus-MacBook-Pro:php80 xxxx$ cd /opt/local/bin/
megumikichikus-MacBook-Pro:bin xxxx$ sudo cp php-cgi80 php-cgi