JOE'S BLOG

好记性不如烂键盘

0%

PHP编译选项和常见错误

记录了PHP各个版本的源码编译选项以及编译过程中出现的错误和解决办法

以下为每个版本的PHP的编译错误,以及可能会出现的问题

PHP7.3.0

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
./configure --prefix=/Users/joe/php-7.3.0 \
--with-config-file-path=/Users/joe/php-7.3.0 \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd-compression-support \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-intl \
--with-mcrypt \
--with-libmbfl \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--disable-fileinfo \
--enable-opcache \
--with-pear \
--enable-maintainer-zts \
--with-ldap=shared \
--without-gdbm \
1
2
3
4
5
6
configure: error: Cannot locate header file libintl.h

在mac上运行
brew install gettext
之后编辑configure文件找到(大概在3.8w行左右)$PHP_GETTEXT /usr/local /usr
并在后面添加/usr/local/opt/gettext
1
2
3
4
5
6
7
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
在mac上运行
brew install icu4c


export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"