Skip to content

Instantly share code, notes, and snippets.

@paolooo
Last active March 22, 2019 02:59
Show Gist options
  • Save paolooo/f6f41b56230b38b20203dacaf7c1eed4 to your computer and use it in GitHub Desktop.
Save paolooo/f6f41b56230b38b20203dacaf7c1eed4 to your computer and use it in GitHub Desktop.
Compiling php 5.5.38 from source in ubuntu bionic guide
# Resources
https://gist.github.com/paolooo/f24d8ad41681c37791dc54b8dc76d921
https://www.crybit.com/20-common-php-compilation-errors-and-fix-unix/
https://www.howtoforge.com/community/threads/problem-with-link.76759/page-2
# Installation
$ wget http://hk1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror -O php-5.5.38.tar.bz2
$ tar jxfv php-5.5.38.tar.bz2
$ mkdir /etc/php/5.5
$ cd php-5.5.38
$ ./configure --prefix=/etc/php/5.5 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring \
--with-libxml-dir=/usr --enable-soap --enable-intl --enable-calendar --with-curl --with-mcrypt --with-zlib \
--with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash \
--enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr \
--enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data \
--with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-gettext --with-xmlrpc --with-xsl \
--with-kerberos --enable-fpm
# Errors
// Error 1
```
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
```
$ ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
// Error 2
```
checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
```
$ apt install libicu-dev
// if that will not fix, try the next solution below:
// 1. download the source see here: http://www.linuxfromscratch.org/blfs/view/8.3/general/icu.html
$ wget http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
$ cd source
$ ./configure --prefix=/usr
$ make
$ make install
// Error 3
```
checking for XSL support... yes
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
```
$ apt install libxslt-dev
$ apt-get install libxml2-dev libxslt-dev python-dev
// Error 4
```
Makefile:635: recipe for target 'ext/openssl/openssl.lo' failed
make: *** [ext/openssl/openssl.lo] Error 1
```
```
https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb.html
```
$ wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb -O libssl1.0-dev.deb
$ dpkg -i libssl1.0-dev
$ apt-get install libssl1.0-dev
// Error 5
```
/home/vagrant/php-5.5.38/ext/curl/interface.c:39:10: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
Makefile:757: recipe for target 'ext/curl/interface.lo' failed
make: *** [ext/curl/interface.lo] Error 1
```
```
// debugging
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
$ find / -type f -name curl.h
$ dpkg -l | grep openssl
ii libxmlsec1-openssl:amd64 1.2.25-1build1 amd64 Openssl engine for the XML security library
ii openssl 1.1.1b-1+ubuntu18.04.1+deb.sury.org+1 amd64 Secure Sockets Layer toolkit - cryptographic utility
ii python3-openssl 17.5.0-1ubuntu1 all Python 3 wrapper around the OpenSSL library
$ dpkg -l | grep curl
ii curl 7.58.0-2ubuntu3.6 amd64 command line tool for transferring data with URL syntax
ii libcurl3-gnutls:amd64 7.58.0-2ubuntu3.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libcurl4:amd64 7.58.0-2ubuntu3.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii php7.1-curl 7.1.26-1+ubuntu18.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.2-curl 7.2.14-1+ubuntu18.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php7.3-curl 7.3.1-1+ubuntu18.04.1+deb.sury.org+1 amd64 CURL module for PHP
$ apt-get install libcurl4-gnutls-dev
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment