VPS 折腾全记录-part 2 

接上文。

搞定了mysql,接下来是php.

我选择的是最新版的php 5.5 beta,解压,进入目录:

我的configure:

[[email protected] php-5.5.0beta3]# ./configure \
> --prefix=/opt/php \
> --disable-cli \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-scan-dir=/etc \
> --disable-ipv6 \ (remove later)
> --with-zlib \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-dba \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-mhash \
> --enable-intl \ (remove later)
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/opt/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/opt/mysql/bin/mysql_config \
> --with-pdo-mysql=/opt/mysql \
> --enable-soap \
> --enable-sockets \
> --enable-wddx \
> --with-xmlrpc \
> --enable-zip \
> --without-pear


检查依赖,报错,提示:

configure: error: ICU version 4.0 or later is required


可是我vps的 centos 4 源里面的ICU 库版本是3.x的。故而放弃启用 "--enable-intl".

之后依赖没有问题,开始编译。报错:

ext/sockets/.libs/conversions.o: In function `from_zval_write_sin6_addr':
/root/php-5.5.0beta3/ext/sockets/conversions.c:610: undefined reference to `php_set_inet6_addr'
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1


经查,这是php 5.5 的一个已知bug,在php 5.3.x 上没有复现。移除显式的禁用ipv6 的 “--disable-ipv6” 后,再次编译通过。

编译完毕,安装。


[[email protected] php-5.5.0beta3]# make install
Installing shared extensions: /opt/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP FPM binary: /opt/php/sbin/
Installing PHP FPM config: /opt/php/etc/
Installing PHP FPM man page: /opt/php/php/man/man8/
Installing PHP FPM status page: /opt/php/php/fpm/
Installing PHP CGI binary: /opt/php/bin/
cp: cannot create regular file `/opt/php/bin/#[email protected]#': No such file or directory
make: *** [install-cgi] Error 1


继续出错,从日志可以看出,创建 bin 目录出错。经查,这也是php的一个已知bug.在没有指定 bin/sbin 的具体路径时会触发。
参见:https://bugs.php.net/bug.php?id=61345

解决方案,手动创建即可。


[[email protected] php-5.5.0beta3]# mkdir /opt/php/bin

[[email protected] php-5.5.0beta3]# make install
/bin/sh /root/php-5.5.0beta3/libtool --silent --preserve-dup-deps --mode=install cp ext/opcache/opcache.la /root/php-5.5.0beta3/modules
Installing shared extensions: /opt/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP FPM binary: /opt/php/sbin/
Installing PHP FPM config: /opt/php/etc/
Installing PHP FPM man page: /opt/php/php/man/man8/
Installing PHP FPM status page: /opt/php/php/fpm/
Installing PHP CGI binary: /opt/php/bin/
Installing build environment: /opt/php/lib/php/build/
Installing header files: /opt/php/include/php/
Installing helper programs: /opt/php/bin/
program: phpize
program: php-config
Installing man pages: /opt/php/php/man/man1/
page: phpize.1
page: php-config.1
Installing PDO headers: /opt/php/include/php/ext/pdo/


至此,php 安装完毕。

可是还没完,还得为其安装 APC 模块。

我使用的是php apc 官方最新的版本,3.1.13。解压,进入目录:

首先运行 phpize,生成 configure 文件.

[[email protected] APC-3.1.13]# phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212


下面开始编译,我的configure:

[[email protected] APC-3.1.13]# ./configure \
> --enable-apc \
> --enable-apc-filehits \
> --with-php-config=/opt/php/bin/php-config


依赖没问题,开始编译。出错,日志如下:

/root/APC-3.1.13/apc_compile.c: In function ‘apc_copy_trait_alias’:
/root/APC-3.1.13/apc_compile.c:2379: error: ‘zend_trait_alias’ has no member named ‘function’
/root/APC-3.1.13/apc_compile.c:2380: error: ‘zend_trait_alias’ has no member named ‘function’
/root/APC-3.1.13/apc_compile.c:2380: error: ‘zend_trait_alias’ has no member named ‘function’
/root/APC-3.1.13/apc_compile.c: In function ‘apc_copy_trait_precedence’:
/root/APC-3.1.13/apc_compile.c:2416: error: ‘zend_trait_precedence’ has no member named ‘function’
/root/APC-3.1.13/apc_compile.c:2417: error: ‘zend_trait_precedence’ has no member named ‘function’
/root/APC-3.1.13/apc_compile.c:2417: error: ‘zend_trait_precedence’ has no member named ‘function’
make: *** [apc_compile.lo] Error 1

搜索无果,没有找到与此相关的任何有用信息。无奈,只好认为是此版本的固有bug。只好使用最新的开发版本试试看。

签出APC 位于 SVN 代码库的最新版本:
svn co http://svn.php.net/repository/pecl/apc/trunk apc

重复之前的步骤,编译通过。囧~看来真是这样。
开始安装插件至php:

[[email protected] apc]# make install
Installing shared extensions: /opt/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing header files: /opt/php/include/php/


这时,记得恢复下之前备份的配置文件,php.ini 和 php-fpm.conf 。

打印下php的版本和模块信息,以做参照。

[[email protected] etc]# php-fpm -v
PHP 5.5.0beta3 (fpm-fcgi) (built: Apr 19 2013 18:36:12)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0-dev, Copyright (c) 1998-2013 Zend Technologies

[[email protected] etc]# php-fpm -m
[PHP Modules]
apc
bz2
calendar
cgi-fcgi
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib

[Zend Modules]


到这里,关于 php 的事情算是完了。

未完待续。
[ ] ( 3239 次浏览 ) 永久链接 ( 3 / 1249 )

<< <上一页 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 下一页> >>