编辑 最后修改时间 2023/07/21 14:00
php5.3.29编译安装
php5.3.29自定义编译安装
安装
安装依赖环境
$ yum install zlib zlib-devel libxml libxml2-devel libjpeg libjpeg-devel freetype freetype-devel libpng libpng-devel gd gd-devel curl curl-devel libxslt libxslt-devel -y
安装libiconv
// 下载libiconv
$ wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
// 编译安装libiconv
$ tar zxf libiconv-1.14.tar.gz
$ cd libiconv-1.14
$ ./configure --prefix=/usr/local/libiconv
// 这一步可能会出现错误: ./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
// 出现错误解决方式
$ vim libiconv-1.14/srclib/stdio.in.h
// 将698行的代码:_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
// 替换为:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
$ make && make install
下载php&解压
$ wget http://cn2.php.net/get/php-5.3.29.tar.gz/from/this/mirror
$ tar xf php-5.3.29.tar.gz && cd php-5.3.29
编译
$ ./configure --prefix=/usr/local/php53 --enable-fpm --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/data/install/lnmp1.7/src/libiconv-1.15 --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-mbstring --enable-static --enable-gd-native-ttf --enable-calendar --enable-exif --enable-pcntl --enable-shmop --with-gettext --with-curl --with-xsl --enable-ftp --with-libxml-dir --with-libxml-dir --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd
$ make && make install
相关问题
/usr/bin/ld: cannot find -lltdl
$ ldconfig -p |grep ltdl
$ ./configure –enable-ltdl-install
configure: error: Please reinstall the iconv library
// 1). #php5.3解决方法:
$ yum install freetype-devel.x86_64
// 2). #php7.1解决方法
$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
$ tar xvzf libiconv-1.14.tar.gz
$ cd libiconv-1.14
$ ./configure --prefix=/usr/local/libiconv-1.14
$ make && make install
$ ln -s /usr/local/libiconv-1.14 /usr/local/libiconv
ext/iconv/iconv.o: In function
php_iconv_stream_filter_dtor': <br> /root/php-5.3.29/ext/iconv/iconv.c:2473: undefined reference to
libiconv_close'
ext/iconv/iconv.o: In function_php_iconv_appendl': <br> /root/php-5.3.29/ext/iconv/iconv.c:337: undefined reference to
libiconv'
/root/php-5.3.29/ext/iconv/iconv.c:374: undefined reference to `libiconv'
$ vim Makefile
// 找到"EXTRA_LIBS = ",追加参数: -liconv
// 追加后为:
// --------------------------------------------------- begin
EXTRA_LIBS = ... -liconv
// --------------------------------------------------- end
/usr/bin/ld: ext/intl/msgformat/msgformat_helpers.o: undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
/usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
// 这是php本身的bug: https://bugs.php.net/bug.php?id=48795
// 解决方式:
$ vim Makefile
// 在107line追加参数: -lstdc++
// 追加后为:
// --------------------------------------------------- begin
107 EXTRA_LIBS = -lcrypt -lz -lexslt -ltidy -lcrypt -lrt -lmcrypt -lgmp -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -l curl -lxml2 -lz -lm -ldl -lssl -lcrypto -ldl -lm -licui18n -licuuc -licudata -ldl -lm -licuio -lodbc -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxslt -lxml2 -lz -ldl -lm -lcrypt -lstdc++
// --------------------------------------------------- end
configure: error: Cannot find libtidy
$ yum install libtidy libtidy-devel
checking for unixODBC support... configure: error: ODBC header file '/usr/local/include/sqlext.h' not found!
$ yum -y install unixODBC-devel
$ ln -s /usr/include/sqlext.h /usr/local/include/sqlext.h
configure: error: Cannot find ldap.h
$ yum install openldap
$ yum install openldap-devel
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation
$ yum install libc-client-devel
$ ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
$ yum -y install libc-client-devel
安装php运行的时候提示缺少:VCRUNTIME140.dll:
安装下面软件:Visual C++ Redistributable for Visual Studio 2015 (vc_redist.x64.exe)
https://www.microsoft.com/en-US/download/details.aspx?id=48145
重启电脑