cd /home/oldboy/tools/php-5.5.32/ext/./ext_skel --extname=redis
然后进入到扩展目录,可以看到如下三个文件,分别进行编辑:
cd redis/lsconfig.m4 ???redis.c ???php_redis.h
操作前养成备份的习惯
按照顺序先编辑config.m4
将
> dnl PHP_ARG_ENABLE(redis, whether to enable redis support,> dnl Make sure that the comment is aligned:> dnl [ ?--enable-redis ??????????Enable redis support])
修改为
< PHP_ARG_ENABLE(redis, whether to enable redis support,< [ ?--enable-redis ??????????Enable redis support])
保存退出
然后编辑redis.c
在这段添加一行代码:PHP_FE(say_hello, ??????NULL)
const zend_function_entry redis_functions[] = { ???????PHP_FE(say_hello, ??????NULL) ???????PHP_FE(confirm_redis_compiled, ?NULL) ??????????/* For testing, remove later. */ ???????PHP_FE_END ?????/* Must be the last line in redis_functions[] */};
在文件末尾添加如下代码:
PHP_FUNCTION(say_hello){ ???????zend_printf("hello redis!");}
保存退出
最后编辑php_redis.h
在这段添加一行代码:PHP_FUNCTION(say_hello)
PHP_FUNCTION(confirm_redis_compiled); ??/* For testing, remove later. */PHP_FUNCTION(say_hello); /* For testing, remove later. */
保存退出
不出意外此时可以执行phpize命令,不报错,问题解决!
phpize建立PHP扩展报错Cannot find config.m4.
原文地址:http://blog.51cto.com/13054614/2144998