Topic: Staticly compile ICU lib for intl extention

Hello,

I'm currently building PHP 5.4 from source and I enabled the intl extention for IDN functions,
i'm doing the builds using docker containers for CentOS 6,

where i start a CentOS6 container

docker run -it --rm --name=builder$(date +%s) --hostname=builder$(date +%s) -e HTTPD_VERSION=2.2.31 -e PHP_VERSION=5.4.45 centos:6

then I call 2 scripts to build Apache and PHP

build-php

#!/bin/bash

set -e
set -u

name='php'
version="${PHP_VERSION:-5.5.33}"

php_file="${name}-${version}.tar.gz"
build_dir="/tmp/builder-$(date +%s)"
php_download_link="il1.php.net/distributions/${php_file}"

num_cpus=$(grep -c "^processor" /proc/cpuinfo) # useful for parallel building

install_packages() {
    
    rpm -Uivh hxxps :// dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm || /bin/true
    rpm -Uivh hxxp :// rpms.remirepo.net/enterprise/remi-release-6.rpm                 || /bin/true
    yum install -y yum-utils
    yum-config-manager --enable remi

    yum install -y gcc gcc-c++ autoconf libxml2-devel perl bison re2c libcurl-devel apr-util-devel apr-devel libicu-last-devel    
    #libicu-devel

}

download_and_extract() {

    mkdir -p "${build_dir}" && cd "${build_dir}"
    curl -s "${php_download_link}" | tar -C "${build_dir}" -xzvf -
}

configure_make_install() {

    if ! cd "${build_dir}/${name}-${version}"
        then
        echo -e "cant cd into build folder [${build_dir}/${name}-${version}]"
        echo "exit 1"
        exit 1
    else
        # configure
        conf_parm="--prefix=/usr/local/lib/php5"                    # root folder to install to
        conf_parm+=" --enable-debug=no"                             # DO NOT Compile with debugging symbols
        conf_parm+=" --enable-maintainer-zts"                       # Enable thread safety - for code maintainers only!!
        conf_parm+=" --enable-pdo"                                  # not used in version 5.5 ?
        conf_parm+=" --enable-shared"                               # ? 
        conf_parm+=" --enable-xml"                                  # ?
        conf_parm+=" --with-curl"                                   # Include cURL support
        conf_parm+=" --with-apxs2=/usr/local/lib/apache2/bin/apxs"  # Build shared Apache 2.0 Handler module. FILE is the optional pathname to the Apache apxs tool apxs
        conf_parm+=" --with-config-file-path=/usr/local/etc/php5"   # Set the path in which to look for php.ini [PREFIX/lib]
        conf_parm+=" --with-zlib"                                   # Include ZLIB support (requires zlib >= 1.0.9)
        conf_parm+=" --enable-intl"                                 # Enable internationalization support / IDN

        ./configure ${conf_parm} && make -j$((num_cpus+1)) && make install

    fi

}

install_packages
download_and_extract
configure_make_install

After that I take the folder /usr/local/lib tar-gzip it and copy it to my testing environment,

but when i try to use it, i get this error message,

Cannot load /usr/local/lib/apache2/modules/libphp5.so into server: libicui18n.so.50: cannot open shared object file: No such file or directory

And I'm asking this because i can't install the libicu from Remi repo on my system (this is a restriction i have) and i do not want to compile it my self. so this is why i ask if i can compile the libicu staticly into libphp5.so ?

thanks in advance,

Re: Staticly compile ICU lib for intl extention

> I do not want to compile it my self. so this is why i ask if i can compile the libicu staticly into libphp5.so ?

You don't want to build it, but you want to build it... doesn't sounds logical.

> i can't install the libicu from Remi repo

Strange (stupid) policy.
You better spend you time auditing and checking my packages, rather the reinventing the wheel.

Simply use a CentOS 7 base image, and you will have PHP 5.4.

Sorry, but I can't really help everyone wanting to build PHP from sources, too much different needs.

And again, work is already done in my repo (if you really want to rebuild, just rebuild the sources RPM).


P.S. especially, PHP 5.4 is EOL upstream, so unsecure, and affected by 1 year of vulnerabilities fixed in maintained version. The PHP 5.4 packages in my repo includes security backports, see the changelog => https://github.com/remicollet/remirepo/ … spec#L1878

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Staticly compile ICU lib for intl extention

Remi wrote:

> I do not want to compile it my self. so this is why i ask if i can compile the libicu staticly into libphp5.so ?

You don't want to build it, but you want to build it... doesn't sounds logical.

> i can't install the libicu from Remi repo

In the building container i can install libicu-latest-devel from your repo, and compile against it.
but i can't install libicu-latest on my prod/dev environment.

Remi wrote:

Strange (stupid) policy.
You better spend you time auditing and checking my packages, rather the reinventing the wheel.

can't agree more smile
but i don't make the rule , i just maintain the system.
this is all part of the process of moving forward from 5.3 to 7 and from RHEL6 to 7.

i just need to now, if i can compile php where libicu will staticly compile into it.

Re: Staticly compile ICU lib for intl extention

> i just need to now, if i can compile php where libicu will staticly compile into it.

No.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70

Re: Staticly compile ICU lib for intl extention

thank you.

Re: Staticly compile ICU lib for intl extention

Closing.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 24 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.8 x86_64 + EPEL + remi + remi-php70