0

I have an old app written in PHP 5.3 that is not to be upgraded and doesn't work with php56 and higher. I'd like to install PHP 5.3 with most of the extensions on FreeBSD 11.2 box. And then I'd like to create package(s) I can use on another machine.

Unfortunately PHP 5.3 is not in the ports anymore. I got older version of ports that consists of PHP 5.3. There is a problem with compiling that port, have many errors and cannot succeed.

Can somebody show path to compile php 5.3 as a port in FreeBSD 11.2?

Thank you in advance.

  • 6
    Upgrading a PHP app is cheap. Putting together a difficult to maintain server with a mix of ancient unsupported and new software is expensive and very high risk. – Michael Hampton Jan 7 '19 at 0:33
  • Why is your app "not to be upgraded"? Which do you rather do, fix the compilation issues for the ports or fix your app? – Tommiie Jan 9 '19 at 8:36
  • It is not always possible to upgrade the application. It this particular case it is commercial product, pretty big application, run in intranet only, secured with IonCube Encoder and not actively maintained. That's way I am looking for ways to get PHP 5.3 running on FreeBSD 11. – norbi771 Jan 10 '19 at 9:24
  • Aha, that's one of the dangers of running commercial software. It's a bad situation to be in. – Michael Hampton Jan 22 '19 at 15:49
  • It is just live. Not everything is open sourced. Windows XP is not maintained anymore and one may have problems starting it on modern device. You may ask, why to run windows xp? Well, for instance a lot of CNC devices run Windows XP embedded with no way to upgrade. :-) – norbi771 Jan 22 '19 at 16:02
0

The comments to your post outline the fact that this task may be not only tricky to attempt as well as difficult to succeed at, but also likely insecure even if you do manage to succeed.

That said, the canonical way would probably be to download an SVN repo of the ports tree, determine which SVN revision number removed the PHP 5.3 support you seek, and then roll your SVN tree back to a revision just prior to that. You'll then have all the requisite problems of finding out whether the source tarballs are still downloadable, whether the supporting libraries and other APIs present in FreeBSD 11.2 are compatible with what the legacy PHP version expects, etc., etc.

| improve this answer | |
  • I understand the comments and I am aware of all of the security aspects and risks and don't need to be convinced to use most recent and supported version of any software including PHP. I would have done that if I could. Since I cannot I try to install PHP 5.3. Before asking the forum I did exactly what you described. At some point however the port installation failed completely and I was unable to continue, even I used tricks and 10+ years experience with FreeBSD. That's way I posted the question hoping that maybe somebody succeed and could help – norbi771 Jan 22 '19 at 15:30
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.