Couldn't compile PHP 7.1: configure: error: xml2-config not found. Please check your libxml2 installation.

  • Hello,

    I has install phpswitcher and want install php7.1

    But I got error.

    Code
    1. checking for xml2-config path...
    2. /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/Makefile:368: recipe for target 'configure-7.1-stamp' failed
    3. [ERROR] main: An unexpected error occurred: An error occurred while executing the install MAKE(1) target for php-7.1.11: aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
    4. ../configure: line 5383: test: too many arguments
    5. configure: error: xml2-config not found. Please check your libxml2 installation.
    6. make: *** [configure-7.1-stamp] Error 1

    I also check my system about libxml2-dev

    Code
    1. root@web1:/var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler# apt-get install libxml2-dev
    2. Reading package lists... Done
    3. Building dependency tree
    4. Reading state information... Done
    5. libxml2-dev is already the newest version (2.9.9+dfsg-1+0~20190828.2+debian9~1.gbp28a022).
    6. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    I has installed it. How to fix it?

    My system is debian 9.9 and install imscp 1.5.3-2018120800 version.

  • As I can see you installed libxml2-dev from sury.org repository.

    This version doesn't contain xml2-config. You should perhaps try to pin the original debian package

  • As I can see you installed libxml2-dev from sury.org repository.

    This version doesn't contain xml2-config. You should perhaps try to pin the original debian package

    Well, in fact, this worked before, but Sury dropped xml2-config in last package version ;) I've forwarded a patch to Sury lately for use of pkg-config in place of xml2-config for detection of libxml2 in PHP 5.6.40. See

    This patch should be ported to PHP 7.1. You can always just put the patch in the /var/www/imscp/gui/plugin/PhpSwitcher/PhpCompiler/php7.1/patches directory and add it to the list of patches to apply, in the /var/www/imscp/gui/plugin/PhpSwitcher/PhpCompiler/php7.1/patches/series file. If the patch don't apply, you'll have to refresh it for PHP 7.1 ...


    Another solution is APT pinning (on the libxml2-dev package provided by Debian repository) in the time being as advised by kess ..


    Anyway, the issue will be fixed in next PhpSwitcher plugin version.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Nuxwin

    Added the Label to be fixed
  • Nuxwin

    Changed the title of the thread from “Install php7.1 got error.” to “Couldn't compile PHP 7.1: configure: error: xml2-config not found. Please check your libxml2 installation.”.
  • Hello, Ihas put patch to it path. I got error.

    What's this problem?

  • Hello, Ihas put patch to it path. I got error.

    What's this problem?


    As stated in my answer, if the patch don't apply, you need refresh it but because I'm pretty sure you don't know how, I'll do that for you and give you the patch for PHP 7.1 ;) Give me 10 minutes please.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • akong7777


    You can find the patch attached below for PHP 7.1.11. Don't forget to remove the old one and update the series file.

    Files

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • testing patch with 7.1 myself

    placed patch - updated series file

    running

    perl /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/php_compiler.pl 7.1


    think patch was good - my issue appears to be more related to ICU Headers now.

    also another sury related change

    thx Nux for documenting that one as well!


    Error Compiling PHP Versions for PHP Switcher

    fixes that (which pinning the libxml2 and libxml2-dev would have probably worked as well!

    but didn't have good cut and paste for that one!



    --- un-related
    kess / Nuxwin you have an idea why I might be getting issues with DB not being recognized when I run installer to change to different PHP base version?

  • Nuxwin

    Set the Label from to be fixed to patched
  • Nuxwin

    Closed the thread.