cd /tmp
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xvfz autoconf-latest.tar.gz
cd autoconf-2.69/
./configure
make
sudo make install
(需要输入你的密码)
autoconf --version 老验证是否安装成功
fyhqytekiMacBook-Pro:tmp fyhqy$ autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
,
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
http://php.net/get/php-5.3.15.tar.gz/from/a/mirror
curl -O http://cn2.php.net/distributions/php-5.3.15.tar.gz
tar zxvf php-5.3.15.tar.gz
cd php-5.3.15/ext/mcrypt/
/usr/bin/phpize
./configure
make
sudo make install
编译的时候可能会提示这行
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
这是因为没有安装mcrypt
curl -O http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/Cellar/mcrypt/2.5.8 --mandir=/usr/local/Cellar/mcrypt/2.5.8/shar
make
sudo make install
4.安装mcrypt
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib/ ./configure -with-libmcrypt-prefix=/usr/local
#make
#make install
说明:由于在配置Mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/文件夹下。因些在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local导入键接库,
mac上有时会在make时有错误:rfc2440.c:26:20: error: malloc.h: No such file or directory,修改 rfc2440.c:#include <malloc.h>为#include <sys/malloc.h>, 重新make/make install即可,如在MAC10.9系统上有问题mcrypt fatal error: 'php.h' file not found,后面有详述
5.生成mcypt.so文件
下载并解压PHP源码文件php-5.3.4.tar.gz(一定是和系统的php的版本号一致)。Mac OS X 10.6.3中预装的PHP版本是5.3.4,所以需要下载这个版本。
在终端执行如下命令:
tar zxvf php-5.3.4.tar.gz
cd php-5.3.4/ext/mcrypt
phpize(如果./configure不能执行 先下载autoconf.tar.gz解压 在autoconf文件夹目录下执行./configure 然后make && make install 安装autoconf后就能在php文件夹下使用./configure配置php了 ,如这个装不上,后面还有详述)
./configure
make
sudo cp modules/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
打开php.ini
sudo vi /etc/php.ini
在usr/etc/php.ini,中加入如下代码,并保存后退出,然后重启Apache(如没有复制php.ini.default,有时要修改写权限:chmod 777 php.ini )
在装mcrypt插件时报错,提示:mcrypt fatal error: 'php.h' file not found,
然后又仔细操作了一次在输完phpize回车时就已经开始出错了,出错信息如下:
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
解决办法:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include
1.curl -O http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz
tar -xzvf m4-1.4.13.tar.gz
cd m4-1.4.13
./configure --prefix=/usr/local
make
sudo make install
cd ..
2.curl -O http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz
tar -xzvf autoconf-2.65.tar.gz
cd autoconf-2.65
./configure --prefix=/usr/local # ironic, isn't it?
make
sudo make install
cd ..
# here you might want to restart your terminal session, to ensure the new autoconf is picked up and used in the rest of the script
3.curl -O http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz
tar xzvf automake-1.11.tar.gz
cd automake-1.11
./configure --prefix=/usr/local
make
sudo make install
cd ..
4.curl -O http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz
tar xzvf libtool-2.2.6b.tar.gz
cd libtool-2.2.6b
./configure --prefix=/usr/local
make
sudo make install