第一步 添加/usr/local/lib到链接库
cd /etc/ld.so.conf.d
vim newconf.conf
添加
/usr/local/lib
保存后退出
sudo ldconfig
第二步 安装
sudo apt-get install mysql-server mysql-client nginx libc-client-dev libmcrypt-dev libXpm-dev libxslt1-dev libmysql -dev libmcrypt-dev libt1-dev libfreetype6-dev libxpm-dev libpng-dev libjpeg-dev libcurl4-gnutls-dev libxml2-dev
sudo cp /usr/lib/x86_64-linux-gnu/libldap* /usr/lib
第三步 安装libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
.configure
make
然后出错:./stdio.h:1010:1: 错误:‘gets未声明(不在函数中)
解决方案如下:
cd srclib/
sed -i -e '/gets is a security/d' ./stdio.in.h
cd ../
make
此时成功后,执行
sudo make install
第四步 安装其他需要的库
tar xf php-5.6.12.tar.gz cd php-5.6.12
./configure --prefix=/usr/local --with-config-file-path=/usr/local/etc --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr --with-zlib --with-curl --with-ldap --with-imap --with-kerberos --with-imap-ssl --with-gettext --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-openssl --with-iconv=/usr/local --with-pcre-dir --with-mhash --with-mcrypt --with-xmlrpc --with-imap --enable-xml --enable-ftp --enable-mbstring --enable-soap --enable-sockets --enable-fpm --enable-zip --disable-debug --enable-calendar --enable-static --enable-inline-optimization --enable-wddx --enable-opcache --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-pcntl --without-pear --enable-ctype
make
sudo make install 中间configure百度一般可以解决错误。