/usr/local/php5/bin/phpize
./configure --help
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make test #就算这里提示出错,不要理它!
make install
cd pdo_mysql/
/usr/local/php5/bin/phpize
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
[root@tuiguangvm pdo]# yum -y install autoconf*
即可解决!
./configure --with-php-config=/usr/local/php5/bin/php-config --with-pdo-mysql=/usr/local/mysql5/
make
make install
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --with-mysqli=/usr/local/mysql5/bin/mysql_config
make
make test 有报错:
Don't forget to run 'make test'.
+-----------------------------------------------------------+
| ! ERROR ! |
| The test-suite requires that proc_open() is available. |
| Please check if you disabled it in php.ini. |
+---------------------------------------------
vi /usr/local/conference/php.ini |
找到disable_functions = shell_exec, system, passthru, exec, popen, proc_open()
改为disable_functions = shell_exec, system, passthru, exec, popen
保存退出。
接着
1 | make test |
通过测试就
make install
可以去查看是否已经生成*.so文件。见附件
checking for mysql_config... not found
configure: error: Cannot find MySQL header files under
在安装pdo_mysql扩展时,提示的错误
解决方法:
在configure时添加另外一个参数即可!
%./configure --with-php-config=/usr/local/php5/bin/php-config --with-pdo-mysql=/usr/local/mysql5 ##mysql的安装目录
cd php-5.2.10
cd ext/
cd pdo_mysql
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --with-pdo-mysql=/usr/local/mysql5
make
make install
2:pdo扩展的安装:
cd php-5.2.10
cd ext/
cd pdo
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
cd php-5.2.10
cd ext/
cd mysqli/
make
make install
4:安装mcrypt扩展
checking for mcrypt support... yes, shared
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决方法:我安装libmcrypt-2.5.7
再次编译时出错如下:
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for mcrypt support... yes, shared
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... no
checking for mcrypt_module_open in -lmcrypt... no
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.
怀疑是libmcrypt版本不兼容所致!
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libcrypt
make
make install
中间我怀疑是php被弄乱(因为在libmcrypt不同的版本下,phpize运行了几次),将php删除后重新解压
cd php-5.2.10
cd mcrypt/
./configure --with-php-config=/usr/local/php5/bin/php-config --with-mcrypt=/usr/local/libcrypt
make
make install
5:%./install-tty
5.1:
/libexec/ld-elf.so.1: Shared object "libm.so.4" not found, required by "php"
解决方法:
%ln -s /usr/lib/libm.so /usr/lib/libm.so.4
5.2:
%./install-tty
/libexec/ld-elf.so.1: Shared object "libutil.so.5" not found, required by "php"
解决方法:
%ln -s /usr/lib/libutil.so /usr/lib/libutil.so.5
%./install-tty
/libexec/ld-elf.so.1: Shared object "libcrypt.so.3" not found, required by "php"
解决方法:
%ln -s /usr/lib/libcrypt.so /usr/lib/libcrypt.so.3
%./install-tty
/libexec/ld-elf.so.1: Shared object "libc.so.6" not found, required by "php"
解决方法:
% ln -s /usr/lib/libc.so /usr/lib/libc.so.6
6:查看freebsd下安装的package
%pkg_info | grep perl
perl-5.8.8_1 Practical Extraction and Report Language
%pkg_info | grep auto
autoconf-2.62 Automatically configure source code on many Un*x platforms
autoconf-wrapper-20071109 Wrapper script for GNU autoconf
%cd
##configure时需要指定--with-php-config,否则会有如下错误:
configure: error: Cannot find php-config. Please use --with-php-config=PATH
安装:
tar jxvf ImageMagick-6.7.9-8.tar.bz2
make
make install
tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
12:SCWS安装
SCWS-1.2.1 安装说明
以 Linux(FreeBSD) 操作系统为例
1. 取得 scws-1.2.1 的代码
wget http://www.xunsearch.com/scws/down/scws-1.2.1.tar.bz2
2. 解开压缩包
[hightman@d1 ~]$ tar xvjf scws-1.2.1.tar.bz2
3. 进入目录执行配置脚本和编译
[hightman@d1 ~]$ cd scws-1.2.1[hightman@d1 ~/scws-1.2.1]$ ./configure --prefix=/usr/local/scws ; make ; make install
注:这里和通用的 GNU 软件安装方式一样,具体选项参数执行 ./configure --help 查看。
常用选项为:--prefix=<scws的安装目录>
4. 顺利的话已经编译并安装成功到 /usr/local/scws 中了,执行下面命令看看文件是否存在
[hightman@d1 ~/scws-1.2.1]$ ls -al /usr/local/scws/lib/libscws.la
5. 试试执行 scws-cli 文件
[hightman@d1 ~/scws-1.2.1]$ /usr/local/scws/bin/scws -h
scws (scws-cli/1.2.1)
Simple Chinese Word Segmentation - Command line usage.
Copyright (C)2007 by hightman.
...
6 用 wget 下载并解压词典,或从主页下载然后自行解压再将 *.xdb 放入 /usr/local/scws/etc 目录中
[hightman@d1 ~/scws-1.2.1]$ cd /usr/local/scws/etc
[hightman@d1 /usr/local/scws/etc]$ wget http://www.xunsearch.com/scws/down/scws-dict-chs-gbk.tar.bz2
[hightman@d1 /usr/local/scws/etc]$ wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2
[hightman@d1 /usr/local/scws/etc]$ tar xvjf scws-dict-chs-gbk.tar.bz2
[hightman@d1 /usr/local/scws/etc]$ tar xvjf scws-dict-chs-utf8.tar.bz2
7. 写个小程序测试一下
[hightman@d1 ~]$ cat > test.c
#include <scws.h>
#include <stdio.h>
main()
{
scws_t s;
s = scws_new();
scws_free(s);
printf("test ok!\n");
}
8. 编译测试程序
gcc -o test -I/usr/local/scws/include -L/usr/local/scws/lib test.c -lscws -Wl,--rpath -Wl,/usr/local/scws/lib
./test
9. 这样就好顺利安装完毕可以使用 libscws 这套 C-API 了
10. 如果您需要在 php 中调用分词,建议继续阅读本文安装 php 扩展,否则可跳过不看。
假设您已经将 scws 按上述步骤安装到 /usr/local/scws 中。
安装此扩展要求您的 php 和系统环境安装了相应的 autoconf automake 工具及 phpize 。
1) 进入源码目录的 phpext/ 目录 ( cd ~/scws-1.2.1 )
2) 执行 phpize (在PHP安装目录的bin/目录下)
3) 执行 ./configure --with-scws=/usr/local/scws
若 php 安装在特殊目录 $php_prefix, 则请在 configure 后加上 --with-php-config=$php_prefix/bin/php-config
4) 执行 make 然后用 root 身份执行 make install
5) 在 php.ini 中加入以下几行
[scws]
;
; 注意请检查 php.ini 中的 extension_dir 的设定值是否正确, 否则请将 extension_dir 设为空,
; 再把 extension = scws.so 指定绝对路径。
;
extension = scws.so
scws.default.charset = gbk
scws.default.fpath = /usr/local/scws/etc
6) 命令行下执行 php -m 就能看到 scws 了或者在 phpinfo() 中看看关于 scws 的部分,记得要重启 web 服务器
才能使新的 php.ini 生效。
7) 这样就算安装完成了,余下的工作只是PHP代码编写问题了。
关于 PHP 扩展的使用说明请参看代码中 phpext/README.md 文件或其它文档章节。
test.c:1:18: error: scws.h: No such file or directory
gcc -o test -I/usr/local/scws/include/scws -L/usr/local/scws/lib test.c -lscws -Wl,--rpath -Wl,/usr/local/scws/lib ##红色的字体为修改的部分
13:APC扩展安装
tar zxvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmapa --with-php-config=/usr/local/php/bin/php-config
make
make install
#tar zxvf xhprof-0.9.2.tgz
#cd xhprof-0.9.2
#cd xhprof-0.9.2/extension/
#/usr/local/php/bin/phpize
#./configure --with-php-config=/usr/local/php/bin/php-config
#make
#make install