cd ~
mkdir software
cd software
wget http://cn2.php.net/distributions/php-5.6.11.tar.gz
tar zxvf php-5.6.11.tar.gz
cd php-5.6.11/ext
#创建扩展项目, 创建完成之后ext目录下会多一个sayhello的文件夹,这个文件夹就是我们的扩展项目
./ext_skel --extname=maxwelldu
cd maxwelldu
vim config.m4
#打开允许, 去掉PHP_ARG_ENABLE这一行前的dnl和 [ --enable-maxwelldu ] 这一行前面的dnl
PHP_ARG_ENABLE(maxwelldu, whether to enable maxwelldu support,
dnl Make sure that the comment is aligned:
[ --enable-maxwelldu Enable maxwelldu support])
#文件末尾添加
vim php_maxwelldu.h
PHP_FUNCTION(maxwelldu);
#在文件末尾添加
phpize
./configure --with-php-config=/usr/bin/php-config
make
make test
make install
#这个时候会自动将扩展放到对应的扩展目录
#修改php的配置文件, 像平时添加mysql,memcache等扩展一样
#重启apache或者php-fpm
extension=maxwelldu.so
service httpd restart
service php-fpm restart
#查看已经安装的扩展