×

记录在Debian8.9编译安装PHP5.2的坑全过程

我的笔记 我的笔记 发表于2019-10-30 11:28:55 浏览3081 评论0

抢沙发发表评论

环境是Debian8.9.

首先需要下载php5.2的包

链接:https://pan.baidu.com/s/1edHDYiRh64oQHBGSpSKu5A 

提取码:ie7x 

然后执行:

上传到linux解压出来:

tar -zxvf php-5.2.17.tar.gz

然后进入

cd php-5.2.17

执行

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

配置

./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=/usr/bin/mysql_config  \
--with-pdo-mysql=/usr \
--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

还碰到

configure:error:libjpeg.(a|so) not found解决


cp -frp /usr/lib64/libjpeg.* /usr/lib

然后报如下错误

If configure fails try –with-xpm-dir=<DIR>;
configure: error: freetype.h not found.

初步怀疑是系统没有安装freetype导致的,我的系统是debian ,于是我执行

[bash]
apt-get install libfreetype6-dev
[/bash]

重新configure php,结果还是一样报如下错误

configure: error: freetype.h not found.

说明刚刚没有安装上,或者不对

干脆直接卸载掉自己编译一个

[bash]
apt-get remove libfreetype6-dev
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz
tar zxvf freetype-2.4.10.tar.gz
cd freetype-2.4.10/
./configure
sudo make && make install
[/bash]

再次configure配置,成功了!


我的笔记博客版权我的笔记博客版权