1. 安装前
apt-get install gcc gcc-c++ autoconf make libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxml2 libxml2-devel patch pcre pcre-devel ImageMagick mhash mhash-devel libmcrypt libmcrypt-devel libevent libevent-devel libxslt libxslt-devel libtool libtool-ltdl libtool-ltdl-devel bison bison-devel
2. configure
./configure --prefix=/usr/local/php55/php --with-config-file-path=/usr/local/php55/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --with-pgsql=/usr/lib/postgresql/9.1 --with-pdo-pgsql=/usr/lib/postgresql/9.1
3.出的警告
configure: WARNING: unrecognized options: --enable-discard-path, --enable-magic-quotes, --enable-safe-mode, --with-curlwrappers, --enable-fastcgi, --enable-force-cgi-redirect, --with-mime-magic
4.去除警告选项
./configure --prefix=/usr/local/php55/php --with-config-file-path=/usr/local/php55/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-pgsql=/usr/lib/postgresql/9.1 --with-pdo-pgsql=/usr/lib/postgresql/9.1
5.configure 成功之后make出现如下问题
ext/xmlrpc/libxmlrpc/.libs/encodings.o: In function `convert':
/data/soft/php-5.5.0/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open'
/data/soft/php-5.5.0/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv'
/data/soft/php-5.5.0/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'
/data/soft/php-5.5.0/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1
5.1 解决第 libiconv 的 undefined
处理方法:
./configure ............
vi Makefile
找到下面这行:
EXTRA_LIBS = -lcrypt ...
在最后添加-liconv
保存后make通过;make install通过。
6.make install 出现到问题
mkdir: cannot create directory `/usr/local/php55': Permission denied
mkdir: cannot create directory `/usr/local/php55/php': No such file or directory
mkdir: cannot create directory `/usr/local/php55/php/lib': No such file or directory
mkdir: cannot create directory `/usr/local/php55/php/lib/php': No such file or directory
mkdir: cannot create directory `/usr/local/php55/php/lib/php/extensions': No such file or directory
mkdir: cannot create directory `/usr/local/php55/php/lib/php/extensions/no-debug-non-zts-20121212': No such file or directory
make: *** [install-modules] 错误 1
7.
linux@linux-Rev-1-0:/data/soft/php-5.5.0$ make install
Installing shared extensions: /usr/local/php55/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP CLI binary: /usr/local/php55/php/bin/
Installing PHP CLI man page: /usr/local/php55/php/php/man/man1/
Installing PHP FPM binary: /usr/local/php55/php/sbin/
Installing PHP FPM config: /usr/local/php55/php/etc/
Installing PHP FPM man page: /usr/local/php55/php/php/man/man8/
Installing PHP FPM status page: /usr/local/php55/php/php/fpm/
Installing PHP CGI binary: /usr/local/php55/php/bin/
Installing build environment: /usr/local/php55/php/lib/php/build/
Installing header files: /usr/local/php55/php/include/php/
Installing helper programs: /usr/local/php55/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php55/php/php/man/man1/
page: phpize.1
page: php-config.1
/data/soft/php-5.5.0/build/shtool install -c ext/phar/phar.phar /usr/local/php55/php/bin
ln -s -f /usr/local/php55/php/bin/phar.phar /usr/local/php55/php/bin/phar
Installing PDO headers: /usr/local/php55/php/include/php/ext/pdo/