I was unable to install PHP 5.3 from ports, even if I checked out older ports version via svn.
I succeed compiling it from source and running with nginx with great help from https://shami.blog/2018/02/running-older-php-versions-on-freebsd-11/
In short, one needs to compile PHP 5.3 with FPM. Not all compilation options work. For me the following config worked:
# pkg install -y gcc6 patch libxml2 curl jpeg png freetype2 mcrypt mariadb100-client libxslt postgresql96-client
# mkdir -p /home/php53
# cd /home/php53
# fetch --no-verify-peer https://museum.php.net/php5/php-5.3.29.tar.gz
# tar xvzf php-5.3.29.tar.gz
# cd php-5.3.29
following https://bugs.php.net/bug.php?id=63983
edit file sapi/fpm/fpm/fpm_sockets.c
just replace
1)info.tcpi_sacked => info.__tcpi_sacked
2)info.tcpi_unacked => info.__tcpi_unacked
and
# ./configure --with-layout=GNU --with-regex=php --with-zend-vm=CALL --enable-zend-multibyte --build=FreeBSD-amd64 --prefix=/usr/local/php53 --exec-prefix=/usr/local/php53 --with-config-file-scan-dir=/usr/local/php53/etc/php --enable-cgi --with-libxml-dir=/usr/local/include/libxml2/libxml/ --enable-ftp --with-xsl=/usr/local/include/libxslt/ --enable-mbstring --with-curl --disable-short-tags --disable-ipv6 --with-curl=/usr/local/include/curl/ --enable-ftp --with-zlib-dir --with-freetype-dir --with-gettext --enable-mbstring --with-xmlrpc --enable-soap --enable-zip --enable-calendar --with-gmp --with-openssl --enable-wddx --with-pgsql=/usr/local/include/pgsql/ --enable-fpm
# make
# make install
then some configuration of nginx and php_fpm
then enabling services in /etc/rc.conf
php_fpm_enable="YES"
nginx_enable="YES"
and voila