月度归档: 2020 年 3 月

  • Debian10编译PHP7.4问题记录

    系统镜像是基于阿里云的 Debian10.6。

    configure参数:

    ./configure --prefix=/usr/local/php/php74 --enable-gd --with-curl --enable-fpm --enable-cgi --with-openssl --enable-mbstring --with-pdo-mysql --with-zlib --with-zip --with-mysqli --enable-opcache --enable-mysqlnd --with-libxml --with-jpeg --with-freetype --with-pdo-sqlite --with-sqlite3 --enable-cli --enable-shared --enable-exif
    

    问题记录

    问题:
    configure: error: Package requirements (openssl >= 1.0.1) were not met:
    No package ‘openssl’ found

    解决:

    apt install libssl-dev

    问题:
    configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
    No package ‘sqlite3’ found

    解决:
    apt-get install libsqlite3-dev

    问题:
    configure: error: Package requirements (libcurl >= 7.15.5) were not met:
    No package ‘libcurl’ found

    解决:
    apt-get install libcurl4-gnutls-dev

    问题:
    configure: error: Package requirements (oniguruma) were not met:
    No package ‘oniguruma’ found

    解决:
    apt install libonig-dev

    问题:
    configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
    No package ‘libzip’ found

    解决:
    apt-get install libzip-dev

    另外,编译时遇到 virtual memory exhausted: Cannot allocate memory 的错误,这是由于阿里云的镜像默认没开启swap的原因,创建一个 swap 内存再编译即可。

    总结一下,在阿里云提供的 debina10 镜像上编译安装 PHP7.4 ,必须安装的依赖有:

    apt install -y  libssl-dev libsqlite3-dev libcurl4-gnutls-dev libonig-dev  libzip-dev

    一点感想:与 CentOS7 相比,Debian10 安装一些依赖非常方便,不用像 CentOS 一样要到处找源,要安装“野包”才能编译。