- 安装依赖
apt-get install libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libmysqlclient15-dev libpspell-dev librecode-dev libcurl4-gnutls-dev libgmp-dev libgmp3-dev librecode-dev libpspell-dev libmysqlclient15-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt1-dev -y
- 下载php7.2.3源码
wget http://cn2.php.net/distributions/php-7.2.3.tar.gz
,解压 - 配置
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-pcntl \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
错误
configure: error: no acceptable C compiler found in $PATH
,执行apt-get install build-essential
安装c,gcc之类的东西-
错误
configure: error: Cannot find OpenSSL's libraries
,解决方案ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/
或者编译安装
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz tar zxf openssl-1.0.2k.tar.gz cd openssl-1.0.2k ./config make && make install
错误
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
,解决方案:
1.sudo apt-get install libcurl4-gnutls-dev
2.cd /usr/include sudo ln -s x86_64-linux-gnu/curl
错误
configure: error: freetype-config not found.
,解决方案:
1.apt-get install libfreetype6-dev
-
错误
configure: error: Unable to locate gmp.h
解决方案:apt-get install libgmp-dev
-
错误
configure: error: Please reinstall readline - I cannot find readline.h
,解决方案:-
apt-get install libreadline-dev
./
-
make && make install