Attempting to build php5.6 on Ubuintu 16.04

Viewed 261

This has been a long path to upgrade a 5-year old server that is using a very old version of Wordpress. The server has been running fine, but it's time to upgrade Wordpress and port the site to a Ubuntu 20.04 server (AWS). It's amazing how many gotchas I have run into.

  1. The server has been running php5.5, running the old Wordpress version.
  2. An attempt to upgrade the Wordpress version to the latest says that a minimum of php5.6 is required.
  3. Sadly, php5.6 is no longer supported by ondrej/php you can try it yourself. This is already well documented online. php5.6 and ubuntu 14.04/16.04 are obsolete.
sudo apt-get update
sudo apt-get install perl apache2 zip gzip tar
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php5.6 libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-xmlrpc
  1. An attempt to upgrade to php7.0+ on the Ubuntu 16.04 server brought a huge number of 'no longer supported in PHP' errors when accessing the old Wordpress site because the latest PHP is not 100% backward compatible to php5.5 code. Sigh. Hundreds of code errors said 'Don't try that path'.
  2. This brought me to an attempt to build and install php5.6 from scratch. This brought about several ratholes such as t1lib no longer being supported (yes the /t1lib.org site still exists, but the ftp site is down and everyone says online -just-give-up-). All of the build instructions on php5.6 include t1lib, but removing that configure directive eliminated the configure error. Compilation completed, and test and install worked fine. I got my /opt/php directories running php5.6. Yay!

So this brings several new problems, and hence the questions.

  1. /opt/php-5.6 isn't in any path. I manually created symbolic links to /usr/bin, /usr/lib, /usr/include, but this seems a tedious and error-prone path. Is there a script that does a full Ubuntu install, not just the /opt/php-5.6 version?
  2. The apache file libphp5.so was not built
/opt/build/php-5.6.40# find . -name \*.so -print
./ext/opcache/.libs/opcache.so
./modules/opcache.so

This of course brought me to an attempt to build php5.6 with apache2 apsw.

./configure     --enable-fpm     --with-mcrypt     --enable-mbstring     --with-openssl     --with-mysql     --with-mysql-sock     --with-gd     --with-jpeg-dir=/usr/lib     --enable-gd-native-ttf      --with-pdo-mysql     --with-libxml-dir=/usr/lib     --with-mysqli=/usr/bin/mysql_config     --with-curl     --enable-zip      --enable-sockets     --with-zlib     --enable-exif     --enable-ftp     --with-iconv     --with-gettext     --enable-gd-native-ttf     --with-freetype-dir=/usr     --prefix=/opt/php-5.6     --with-config-file-path=/opt/php-5.6/etc     --with-fpm-user=www-data     --with-fpm-group=www-data  --with-apxs2=/usr/local/apache2/bin/apxs
checking for grep that handles long lines and -e... /bin/grep
...
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS...

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/local/apache2/bin/apxs follows:
./configure: line 8417: /usr/local/apache2/bin/apxs: No such file or directory
configure: error: Aborting

Then an attempt to obtain apsx for Ubuntu 16.04 went so deep down a rathole that I gave up.

Can somebody provide a link to libphp5.so? I'm guessing that this .so will work with 5.6. Or maybe somebody has a repo that has php5.6 available (and built properly)? I don't care about the many security flaws. This is just a temporary step to get to the latest Wordpress on 20.04.

Or can somebody provide some hints to the two questions above? This has been so much of a waste of time.

0 Answers
Related