phpize建立PHP擴展報錯Cannot find config.m4.
阿新 • • 發佈:2018-07-16
問題 find The oldboy 保存 pre comm 擴展報錯 ble 首先進入PHP的源碼安裝包目錄下面執行一條命令:
cd /home/oldboy/tools/php-5.5.32/ext/
./ext_skel --extname=redis
然後進入到擴展目錄,可以看到如下三個文件,分別進行編輯:
cd redis/
ls
config.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.