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. When this guide was written in early 2019, PHP 7.3 was the newest stable branch, but it reached end of life on 6 December 2021 and gets no security fixes today. You can read what changed in PHP 7.3 to see what was new and deprecated in that release.
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. This page was checked again in October 2026 against PHP’s end of life table, the FreeBSD ports history and the PHP2Shell advisory, but the install steps below were not re-run, because the php73 packages they install no longer exist.
The steps below are kept as a record of how PHP 7.3 went onto a FreeBSD 12 server. If you still run that combination, read the next section first: it tells you how exposed the box is and where to go instead.
PHP2Shell and PHP 7.3 on FreeBSD 12: no patched package exists
PHP2Shell is the name for CVE-2026-109618 and CVE-2026-109619, two critical remote code execution bugs in PHP itself that the PHP project fixed on 21 October 2026 in 8.5.12, 8.4.27, 8.3.36 and 8.2.35 only. PHP 7.3 is not on that list, FreeBSD removed the lang/php73 port on 26 January 2022, and FreeBSD 12 lost security support on 31 December 2023, so no package, port or freebsd-update run will patch a PHP 7.3 server on FreeBSD 12. The PHP security advisory says it plainly: 8.1 and older no longer get updates from the PHP project.
Moving off this stack is the only real fix. Build a supported FreeBSD 14 or 15 server, install a supported PHP branch on it by following our guide to installing PHP on a current FreeBSD release, then migrate the application. Code written for 7.3 needs testing on 8.x before the cut over, so start with a staging copy rather than the live site. After installing, run pkg audit -F: it must report nothing for your php8x package, because the FreeBSD 14 package branches can lag a day or two behind a PHP release.
Two commands tell you where an old box stands. php -v prints the branch, and any 7.3.x build is affected. pkg audit -F downloads the current FreeBSD vulnerability database (VuXML) and checks every installed package against it. Run both as root, or with sudo if it is installed:
php -v
sudo pkg audit -F
Don’t read a quiet audit as a clean bill. In practice VuXML only lists ports still in the tree, and the PHP2Shell entry covers the currently supported php8x ports with no php72, php73 or php80 range. On a FreeBSD 14 lab VM in October 2026 we asked the same database about the 7.3.1 build this guide installed and the final 7.3.33 build:
sudo pkg audit -F php73-7.3.1 php73-7.3.33
The 7.3.1 build shows two bugs from 2019 and 2020, and 7.3.33 shows nothing at all, even though both are open to PHP2Shell:
vulnxml file up-to-date
php73-7.3.1 is vulnerable:
php72 -- use of freed hash key
CVE: CVE-2020-7068
WWW: https://vuxml.FreeBSD.org/freebsd/ee261034-b95e-4479-b947-08b0877e029f.html
php -- env_path_info underflow in fpm_main.c can lead to RCE
CVE: CVE-2019-11043
WWW: https://vuxml.FreeBSD.org/freebsd/6a7c2ab0-00dd-11ea-83ce-705a0f828759.html
2 problem(s) in 1 package(s) found.
So on this branch the version string from php -v is the verdict, and pkg audit is only useful for the rest of the system. If the server must stay up until the migration is done, the advisory lists interim measures that reduce exposure and are not a fix:
- In the PHP-FPM pool,
php_admin_value[memory_limit] = -1, so no application can lower it again. It lets one request eat all RAM, so watch memory. - In the pool or php.ini,
php_admin_flag[session.upload_progress.enabled] = off(orsession.upload_progress.enabled = 0), never throughini_set()or .user.ini, then restart every PHP worker. - A low
post_max_size: 8M when the site takes no uploads, 32M when it does, withupload_max_filesizebelow it.
On a mod_php server the same stopgaps go into the Apache configuration, where applications cannot override them. Create a small include file for them:
vim /usr/local/etc/apache24/Includes/php2shell.conf
Add these three lines, which are interim measures and not a fix:
php_admin_value memory_limit -1
php_admin_flag session.upload_progress.enabled off
php_admin_value post_max_size 8M
Restart Apache so every worker picks them up.
service apache24 restart
Check those values through a page served by the web server, because the PHP CLI reads a different configuration. Then plan the move, since the PHP project is clear that only an update closes these bugs.
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. Note that portsnap was removed in FreeBSD 14.0, where the ports tree comes from git instead (pkg install git, then git clone https://git.FreeBSD.org/ports.git /usr/ports), and a current ports tree has no lang/php73 directory at all.
portsnap fetch update
This was the output on FreeBSD 12 in January 2019:
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
The ports tree then sits under /usr/ports, which the ports method in Step 3 builds from.
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
The catalog update looked like this:
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.
With the catalog current, pkg can resolve php73 and its dependencies.
Step 3: Install PHP 7.3 on FreeBSD
There are two ways you can install PHP 7.3 on FreeBSD. Both stopped working once the port was removed in January 2022: pkg finds no php73 package, and the ports tree has nothing to build.
- Install from Binary packages
- 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
In 2019 pkg pulled in three packages:
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
The 2019 build reported 7.3.1, which is now open to PHP2Shell like every other 7.3 release:
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
The CLI works, so the next job is the extensions most PHP applications expect.
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
Building from ports was the other route, useful when you need build options the binary package did not enable.
Installing PHP 7.3 from FreeBSD from ports
Change your working directory to PHP 7.3 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/php73-extensions/
make install clean
Thatβs all. You now have PHP 7.3 installed on your FreeBSD server. On any server you still look after, treat that install as something to retire, not to keep: the PHP2Shell section above has the check and the way out.
PHP Web Programming Video Courses:
- The Complete Web Developer Course
- PHP for Beginners – Become a PHP Master – CMS Project
- The Complete PHP Full Stack Web Developer Bootcamp
- PHP with Laravel for beginners – Become a Master in Laravel
- PHP OOP: Object Oriented Programming for beginners + Project
See other FreeBSD tutorials: