We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install PHP 7.3 on FreeBSD 12

Learn how to – How To Install PHP 7.3 on FreeBSD 12.

Are you looking for an easy way to Install PHP 7.3 on FreeBSD 12?. My previous guide was on installing PHP 7.2 on FreeBSD 12. PHP is among top popular programming languages powering the internet. PHP 7.3 is available for the general use and is production ready. You can read more on PHP 7.3 release notes to know what’s new and deprecated.

I’m beginning to fall for FreeBSD as my web applications hosting server. It is stable, secure and has comprehensive documentation which gets you up to speed in no time.

Follow the steps provided in this article to have PHP 7.3 installed in your FreeBSD server. I’ll try to provide step by step installation and configuration of various services on FreeBSD.

Step 1: Update ports tree

Start by updating your FreeBSD server Ports tree using the portsnap command. This is a must do if planning to install PHP 7.3 from source.

# 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 Sat Jan 26 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 Sat Jan 26 00:07:39 UTC 2019 to Sat Jan 26 15: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.

When running Portsnap for the first time, you need to extract the snapshot into /usr/ports:

# portsnap extract

Step 2: Updating package repository

You can choose to install PHP 7.3 on FreeBSD 12 from FreeBSD ports or from binary files. Since we will use the latter, let’s update package repository catalog.

# 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.

Step 3: Install PHP 7.3 on FreeBSD

There are two ways you can install PHP 7.3 on FreeBSD.

  1. Install from Binary packages
  2. Install from source using ports

Method 1: Install PHP 7.3 on FreeBSD from binary

Run the command below to install PHP 7.3 on FreeBSD from binary.

# 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%

Confirm PHP version installed.

# 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

Install PHP 7.3 Extensions on FreeBSD

Extensions can be installed using syntax php73-<extension>. See example below which installs standard extensions.

# 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

Accept package installation by pressing 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

You can view loaded modules with:

# php -m

Installing PHP 7.3 from FreeBSD from ports

Change your working directory to PHP 7.2 ports folder

# cd /usr/ports/lang/php73

Then build and install PHP 7.3

# make install clean

To  install PHP 7.3 extensions on FreeBSD from ports, change to extensions ports directory and run:

# cd /usr/ports/lang/php72-extensions/
# make install clean

That’s all. You now have PHP 7.3 installed on your FreeBSD server.

PHP Web Programming Video Courses:

See other FreeBSD tutorials:

Cart

Your Cart is Empty

Back To Shop