Last active
February 13, 2023 05:53
-
-
Save bookiu/f6d206c72cc34c9be7ae8b47e5a78a12 to your computer and use it in GitHub Desktop.
Ubuntu下PHP7编译安装参数以及系统依赖库安装
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://cn2.php.net/distributions/php-7.2.4.tar.gz | |
tar zxvf php-7.2.4.tar.gz | |
cd php-7.2.4 | |
# Base directory | |
PHP_INSTALL_DIR='/usr/local/php72' | |
PHP_CONFIG_DIR="$PHP_INSTALL_DIR/etc" | |
PHP_CONFIG_SCAN_DIR="$PHP_CONFIG_DIR/php.d" | |
# Dependency | |
apt-get install -y pkg-config libxml2-dev libxslt1-dev libssl-dev libbz2-dev \ | |
libcurl4-gnutls-dev libjpeg-dev libpng-dev libwebp-dev libfreetype6-dev \ | |
libmcrypt-dev libreadline-dev | |
./configure \ | |
--prefix=$PHP_INSTALL_DIR \ | |
--with-config-file-path=$PHP_CONFIG_DIR \ | |
--with-config-file-scan-dir=$PHP_CONFIG_SCAN_DIR \ | |
--with-fpm-user=www \ | |
--with-fpm-group=www \ | |
--enable-fpm \ | |
--disable-ipv6 \ | |
--enable-ctype=shared \ | |
--enable-dom=shared \ | |
--enable-pdo=shared \ | |
--enable-hash=shared \ | |
--enable-json=shared \ | |
--enable-phar=shared \ | |
--enable-posix=shared \ | |
--enable-session=shared \ | |
--enable-opcache=shared \ | |
--enable-fileinfo=shared \ | |
--enable-tokenizer=shared \ | |
--enable-xml=shared \ | |
--enable-libxml=shared \ | |
--enable-simplexml=shared \ | |
--enable-xmlreader=shared \ | |
--enable-xmlwriter=shared \ | |
--enable-bcmath=shared \ | |
--enable-ftp=shared \ | |
--enable-mbstring=shared \ | |
--enable-pcntl=shared \ | |
--enable-shmop=shared \ | |
--enable-sockets=shared \ | |
--enable-zip=shared \ | |
--enable-calendar=shared \ | |
--enable-mysqlnd=shared \ | |
--enable-exif=shared \ | |
--enable-libxml=shared \ | |
--with-pcre-jit \ | |
--with-zlib=shared \ | |
--with-bz2=shared \ | |
--with-curl=shared \ | |
--with-gd=shared \ | |
--with-mhash=shared \ | |
--with-readline=shared \ | |
--with-openssl=shared \ | |
--with-iconv=shared \ | |
--with-pear=shared \ | |
--with-xsl=shared \ | |
--with-mysqli=shared \ | |
--with-pdo-mysql=shared \ | |
--with-sqlite3=shared \ | |
--with-pdo-sqlite=shared | |
# 下面一行为了解决错误: | |
# /usr/local/src/php-7.1.2/sapi/phpdbg/phpdbg_cmd.c:765: undefined reference to `readline' | |
# /usr/local/src/php-7.1.2/sapi/phpdbg/phpdbg_cmd.c:773: undefined reference to `add_history' | |
# collect2: error: ld returned 1 exit status | |
# Makefile:351: recipe for target 'sapi/phpdbg/phpdbg' failed | |
# make: *** [sapi/phpdbg/phpdbg] Error 1 | |
# make: *** Waiting for unfinished jobs.... | |
sed -i "s/^EXTRA_LIBS.*/& -lreadline/g" Makefile | |
make -j `grep 'processor' /proc/cpuinfo | wc -l` | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CentOS 6.5 也遇到了 readline 的问题,通过 -lreadline 可以解决~