我的服务器上已经装好apache2了, 今天想装一个FastCGI上去, 于是从http://www.fastcgi.com/dist/下载了http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz, 解压, 编译并安装:
$/usr/local/apache/bin/apxs -n mod_fastcgi.so -i -a -c *.c
结果出错了:
mod_fastcgi.c: In function `init_module':
mod_fastcgi.c:270: `ap_null_cleanup' undeclared (first use in this function)
mod_fastcgi.c:270: (Each undeclared identifier is reported only once mod_fastcgi.c:270: for each function it appears in.)
找了好长时间的原因, 终于找到答案了:
原来apache2已经将ap_null_cleanup名字变为apr_pool_cleanup_null了, 还有一些名字也变了.
解决的办法:
手动修改mod_fastcgi-2.4.2/fcgi.h文件(注意以加号开始的行表示新添加的):
#define ap_reset_timeout(a)
#define ap_unblock_alarms()
+/* starting with apache 2.2 the backward-compatibility defines for
+ * 1.3 APIs are not available anymore. Define them ourselves here.
+ */
+#ifndef ap_copy_table
+
+#define ap_copy_table apr_table_copy
+#define ap_cpystrn apr_cpystrn
+#define ap_destroy_pool apr_pool_destroy
+#define ap_isspace apr_isspace
+#define ap_make_array apr_array_make
+#define ap_make_table apr_table_make
+#define ap_null_cleanup apr_pool_cleanup_null
+#define ap_palloc apr_palloc
+#define ap_pcalloc apr_pcalloc
+#define ap_psprintf apr_psprintf
+#define ap_pstrcat apr_pstrcat
+#define ap_pstrdup apr_pstrdup
+#define ap_pstrndup apr_pstrndup
+#define ap_push_array apr_array_push
+#define ap_register_cleanup apr_pool_cleanup_register
+#define ap_snprintf apr_snprintf
+#define ap_table_add apr_table_add
+#define ap_table_do apr_table_do
+#define ap_table_get apr_table_get
+#define ap_table_set apr_table_set
+#define ap_table_setn apr_table_setn
+#define ap_table_unset apr_table_unset
+
+#endif /* defined(ap_copy_table) */
+
#if (defined(HAVE_WRITEV) && !HAVE_WRITEV && !defined(NO_WRITEV)) || defined WIN32
#define NO_WRITEV
#endif
然后保存文件, 重新编译安装.