phpize创建PHP扩展报错Cannot find config.m4.

首先进入PHP的源码安装包目录下面执行一条命令:php

cd /home/oldboy/tools/php-5.5.32/ext/
./ext_skel --extname=redis

而后进入到扩展目录,能够看到以下三个文件,分别进行编辑:redis

cd redis/
ls
config.m4    redis.c    php_redis.h

操做前养成备份的习惯
按照顺序先编辑config.m4
ide

> dnl PHP_ARG_ENABLE(redis, whether to enable redis support,
> dnl Make sure that the comment is aligned:
> dnl [  --enable-redis           Enable redis support])

修改成code

< PHP_ARG_ENABLE(redis, whether to enable redis support,
< [  --enable-redis           Enable redis support])

保存退出rem

而后编辑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[] */
};

在文件末尾添加以下代码:it

PHP_FUNCTION(say_hello)
{
        zend_printf("hello redis!");
}

保存退出io

最后编辑php_redis.h
在这段添加一行代码:PHP_FUNCTION(say_hello)ast

PHP_FUNCTION(confirm_redis_compiled);   /* For testing, remove later. */
PHP_FUNCTION(say_hello); /* For testing, remove later. */

保存退出function

不出意外此时能够执行phpize命令,不报错,问题解决!

相关文章
相关标签/搜索