在Linux虚拟机VirtualBox里安装并运行FreeBSD 12,现在为FreeBSD 12系统安装PHP 7.3,以下是详细步骤。参考在Ubuntu 18.04/Debian 9上安装VirtualBox 6.0的方法安装虚拟机。
步骤一、更新ports tree 首先使用portsnap命令更新FreeBSD服务器ports tree,如果计划从源代码安装PHP 7.3,这是必须的: # portsnap fetch update Looking up portsnap.FreeBSD.org mirrors… 6 mirrors found. Fetching public key from ec2-eu-west-1.portsnap.freebsd.org… done. Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org… done. Fetching snapshot metadata… done. Fetching snapshot generated at Wed Mar 06 00:07:39 UTC 2019: .... Extracting snapshot… done. Verifying snapshot integrity… done. Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org… done. Fetching snapshot metadata… done. Updating from Wed Mar 06 00:07:39 UTC 2019 to Wed Mar 06 10:32:34 UTC 2019. Fetching 5 metadata patches… done. Applying metadata patches… done. Fetching 0 metadata files… done. Fetching 101 patches. (101/101) 100.00% done. done. Applying patches… done. Fetching 120 new ports or files… done. /usr/ports was not created by portsnap. 首次运行Portsnap时,需要将快照解压缩到/usr/ports: # portsnap extract
步骤二、更新包存储库 你可以选择从FreeBSD端口或二进制文件在FreeBSD 12上安装PHP 7.3,由于我们将使用后者,让我们更新包存储库目录: # pkg update Updating FreeBSD repository catalogue… Fetching meta.txz: 100% 944 B 0.9kB/s 00:01 Fetching packagesite.txz: 100% 6 MiB 668.5kB/s 00:10 Processing entries: 100% FreeBSD repository update completed. 32066 packages processed. All repositories are up to date.
步骤三、在FreeBSD上安装PHP 7.3 有两种方法可以在FreeBSD上安装PHP 7.3: 1、从二进制包安装。 2、使用端口从源安装。 方法1:从二进制文件在FreeBSD上安装PHP 7.3 运行以下命令在FreeBSD上从二进制文件安装PHP 7.3: # pkg install php73 Updating FreeBSD repository catalogue… FreeBSD repository is up to date. All repositories are up to date. The following 3 package(s) will be affected (of 0 checked): New packages to be INSTALLED: php73: 7.3.1 libargon2: 20171227_1 pcre2: 10.31 Number of packages to be installed: 3 The process will require 31 MiB more space. 4 MiB to be downloaded. Proceed with this action? [y/N]: y [1/3] Fetching php73-7.3.1.txz: 100% 3 MiB 858.4kB/s 00:04 [2/3] Fetching libargon2-20171227_1.txz: 100% 64 KiB 65.2kB/s 00:01 [3/3] Fetching pcre2-10.31.txz: 100% 1 MiB 400.8kB/s 00:03 Checking integrity… done (0 conflicting) [1/3] Installing libargon2-20171227_1… [1/3] Extracting libargon2-20171227_1: 100% [2/3] Installing pcre2-10.31… [2/3] Extracting pcre2-10.31: 100% [3/3] Installing php73-7.3.1… [3/3] Extracting php73-7.3.1: 100% 方法2:从端口安装PHP 7.3 将你的工作目录更改为PHP 7.3 ports文件夹: # cd /usr/ports/lang/php73 然后构建并安装PHP 7.3: # make install clean 要从端口安装FreeBSD上的PHP 7.3扩展,请更改为扩展端口目录并运行: # cd /usr/ports/lang/php73-extensions/ # make install clean 至此,已经在FreeBSD上成功安装了PHP 7.3。 附:确认已安装PHP版本: # php -v PHP 7.3.1 (cli) (built: Jan 15 2019 01:15:01) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
步骤四、在FreeBSD上安装PHP 7.3扩展 可以使用语法php73-<extension>安装扩展,请参阅下面的安装标准扩展的示例: # pkg install php73-curl php73-extensions php73-json php73-xml php73-zip php73-intl php73-mysqli php73-pdo_mysql php73-pdo php73-pear php73-soap php73-phar 按y键接受包安装: New packages to be INSTALLED: php73-curl: 7.3.1 php73-extensions: 1.0 php73-json: 7.3.1 php73-xml: 7.3.1 php73-zip: 7.3.1 php73-intl: 7.3.1 php73-mysqli: 7.3.1 php73-pdo_mysql: 7.3.1 php73-pdo: 7.3.1 php73-pear: 1.10.6 php73-soap: 7.3.1 php73-phar: 7.3.1 curl: 7.62.0 libnghttp2: 1.35.1 ca_root_nss: 3.41.1 php73-session: 7.3.1 php73-opcache: 7.3.1 php73-xmlwriter: 7.3.1 php73-xmlreader: 7.3.1 php73-dom: 7.3.1 php73-simplexml: 7.3.1 php73-ctype: 7.3.1 php73-posix: 7.3.1 php73-hash: 7.3.1 php73-filter: 7.3.1 php73-tokenizer: 7.3.1 php73-sqlite3: 7.3.1 sqlite3: 3.26.0 php73-pdo_sqlite: 7.3.1 php73-iconv: 7.3.1 libzip: 1.5.1 icu: 63.1_1,1 php73-zlib: 7.3.1 Number of packages to be installed: 33 The process will require 62 MiB more space. 14 MiB to be downloaded. Proceed with this action? [y/N]: y 你可以使用以下命令查看已加载: # php -m 至此,在FreeBSD上安装PHP 7.3扩展的内容讲完了。
相关主题 |