Install intl PHP 7.1 extension in a PHP multiple version server

Discussion in 'Installation/Configuration' started by Enrique García, Jan 29, 2017.

  1. Enrique García

    Enrique García New Member HowtoForge Supporter

  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    I did not tried it, but it should work

    Code:
    cd /opt/php-7.1/etc
    pecl update-channels
    pecl install intl
    echo extension=intl.so >> /opt/php-7.1/lib/php.ini
     
  3. Hbod

    Hbod Member

    This won't work for many reasons. pecl install intl would install that for the default PHP Version, not the one inside /opt/. The right way would be to

    > pecl -C ./pear.conf install intl

    But also this won't work, as the compiling intl-source is updated 3 years ago and will complain and terminate compiling
    /tmp/pear/temp/intl/intl_error.h:24:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
    #include <ext/standard/php_smart_str.h>

    as php_start_str was renamed to php_start_string in PHP7. I don't see any way to get this installed. So bad! Any ideas?
     
  4. ahrasis

    ahrasis Active Member

    Actually there is another option to install multiple php version and use them together via ISPC with your preferred extensions for them, that is via installing ondrej ppa like this:
    Code:
    add-apt-repository ppa:ondrej/php
    apt-get update && apt-get -y upgrade
    Afterwards you install php version that you want i.e. php5.6 to php7.1 as prescribed in the How Tos (Note that php5.5 is no longer supported) something like this:
    Code:
    apt-get -y install php7.1-opcache php7.1-fpm php7.1 php7.1-common php7.1-gd php7.1-mysql php7.1-imap php7.1-cli php7.1-cgi php-pear php-auth php7.1-mcrypt mcrypt imagemagick libruby php7.1-curl php7.1-intl php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl memcached php-memcache php-imagick php-gettext php7.1-zip php7.1-mbstring
    Then in your ISPC Additional PHP Settings > For FastCGI add something like:
    Code:
    Path to the PHP FastCGI binary = /usr/bin/php-cgi7.1
    Path to the php.ini directory = /etc/php/7.1/cgi
    
    For > PHP-FPM
    Code:
    Path to the PHP-FPM init script = /etc/init.d/php7.1-fpm
    Path to the php.ini directory = /etc/php/7.1/fpm
    Path to the PHP-FPM pool directory = /etc/php/7.1/fpm/pool.d
    
    For some it is easier to add phpVersions and their extensions this way, but for others adding them without relying to ondrej ppa is preferred.

    If your server is still on testing and not on production yet, you may want to give this another-way-around a try. ;)
     
    Last edited: Mar 1, 2017
    gOOvER likes this.
  5. Rafael Santana

    Rafael Santana New Member



    ahrasis, Just follow these steps quoted above by you is will work?
     
    Last edited: Jun 11, 2017
  6. ahrasis

    ahrasis Active Member

    Yes. This is the simplest way I know that work with my Ubuntu 16.04 built. Most of my sites use php7.1 that is installed using this trick.

    Please note my server is a private server i.e. for private use only. So those who intend to run a public server should follow the guide / tutorial instead of the mentioned trick.
     
  7. Rafael Santana

    Rafael Santana New Member

    I also tried to follow the steps for installing PHP 7.1 on Debian 8 from this link.
    https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/



    But he made some mistakes in "Copy php.ini and php-fpm.conf to the correct locations - step":

    Copy php.ini and php-fpm.conf to the correct locations:

    cp /usr/local/src/php7-build/php-7.1.2/php.ini-production /opt/php-7.1/lib/php.ini
    cp /opt/php-7.1/etc/php-fpm.conf.default /opt/php-7.1/etc/php-fpm.conf
    cp /opt/php-7.1/etc/php-fpm.d/www.conf.default /opt/php-7.1/etc/php-fpm.d/www.conf



    Always the error message below appears:
    [email protected]:/usr/local/src/php7-build/php-7.1.2# cp /usr/local/src/php7-build/php-7.1.2/php.ini-production /opt/php-7.1/lib/php.ini
    cp: cannot create regular file '/opt/php-7.1/lib/php.ini': No such file or directory
    [email protected]:/usr/local/src/php7-build/php-7.1.2# cp /opt/php-7.1/etc/php-fpm.conf.default /opt/php-7.1/etc/php-fpm.conf
    cp: cannot stat '/opt/php-7.1/etc/php-fpm.conf.default': No such file or directory
    [email protected]:/usr/local/src/php7-build/php-7.1.2# cp /opt/php-7.1/etc/php-fpm.d/www.conf.default /opt/php-7.1/etc/php-fpm.d/www.conf
    cp: cannot stat '/opt/php-7.1/etc/php-fpm.d/www.conf.default': No such file or directory

    I would like to add PHP 7.1 as an additional version. I can not go on from this point forward.
    Has anyone been able to perform this setup?
     
  8. Rafael Santana

    Rafael Santana New Member

  9. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    you missed at least one step:
    mkdir /opt/php-7.1
     
  10. Rafael Santana

    Rafael Santana New Member

    [email protected]:~# mkdir /opt/php-7.1
    mkdir: cannot create directory '/opt/php-7.1': File exists
     
  11. dimiandre

    dimiandre New Member

    Hi guys!
    i've found a solution for this without having to use the ondrej ppa that's not safe for production environments.
    From php 5.5 php-intl it's alredy included in PHP binary, it just have to be enabled during the configuration of the build.

    If you are reading this you probably compiled PHP 7 by yourself to have two-three version on the same machine, in my case i'm using debian and nginx

    First, locate your old build folder. I Hope you didn't deleted that, in my case was:
    Code:
    cd /usr/local/src/php7-build
    cd php-7.1.2
    
    now you have to re-configure the build including the "--enable-intl" option.
    Code:
    ./configure --prefix=/opt/php-7.1 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --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-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --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-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --enable-intl
    now just make && make install
    restart php-fpm and you are done.

    /etc/init.d/php-7.1-fpm stop
    /etc/init.d/php-7.1-fpm start
     

Share This Page