php扩展...

安装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
重启电脑

 

php5.3.29自定义编译安装

1. 安装依赖环境
 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

2. 下载libiconv
 wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz

3. 编译安装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)
#出现错误解决方式
vi 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

4. 下载php
wget http://cn2.php.net/get/php-5.3.29.tar.gz/from/this/mirror

5. 解压php

tar xf php-5.3.29.tar.gz

cd php-5.3.29

6. 编译
./configure \
 --prefix=/usr/local/php5.3.29 \
 --enable-fpm \
 --with-xmlrpc \
 --with-openssl \
 --with-zlib \
 --with-freetype-dir \
 --with-gd \
 --with-jpeg-dir \
 --with-png-dir \
 --with-iconv=/usr/local/libiconv \
 --enable-short-tags \
 --enable-sockets \
 --enable-zend-multibyte \
 --enable-soap \
 --enable-mbstring \
 --enable-static \
 --enable-gd-native-ttf \
 --with-curl \
 --with-xsl \
 --enable-ftp \
 --with-libxml-dir \
 --with-MySQL=mysqlnd \
 --with-mysqli=mysqlnd \
 --with-pdo-mysql=mysqlnd \
 --with-mhash \
 --with-mcrypt \
 --with-libxml-dir

7. make安装
 make && make install

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  
php5.3.29自定义编译安装一大堆扩展
 
1). 完成以上 1~5 步操作后,选择以下扩展进行编译:
 
//----------------------------------------------------begin
 
./configure  --prefix=/usr/local/php5.3 --enable-fpm --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv --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
 
//----------------------------------------------------end
 
 
编译安装常见错误:
 
1. 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
 
 
2. 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
 
 
3. configure: error: Cannot find ldap.h
> yum install openldap
> yum install openldap-devel
 
 
4. 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
 
 
5. configure: error: Cannot find libtidy
> yum install libtidy libtidy-devel
 
 
6. /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
 
 
8. ext/iconv/iconv.o: In function `php_iconv_stream_filter_dtor':
/root/php-5.3.29/ext/iconv/iconv.c:2473: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_appendl':
/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
 
 
8. 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
 
9. /usr/bin/ld: cannot find -lltdl
> ldconfig -p |grep ltdl
> ./configure  –enable-ltdl-install
 
  








 

 

 

---------------------------------------------------------------------------------------------
唯有志存高远,方能风行天下。

道之所存,虽千万人吾往矣! 情之所钟,虽千万里吾念矣~

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。