- 论坛徽章:
- 0
|
记叙整理:laozei (
http://laozei.blogchina.com
)
在apache 2.2.0上想以fastcgi的方式来运行php,却发现ports里的mod_fastcgi只支持apache 1.3.x和2.0.x,经过几番寻找和尝试,终于在freebsd官方站找到合适的补丁(patch)。
鉴于freebsd官方站被伟大的裤裆给封锁,国内难以访问,遂把此补丁及动作过程记录如下:
1.cd /usr/ports/www/mod_fastcgi
2.把下面的补丁代码复制粘贴到文本文档patch22,路径为:
/usr/ports/www/mod_fastcgi/patch22
3.打补丁,命令:
patch -p1
-
-.if defined(WITH_APACHE2) || exists(${LOCALBASE}/include/apache2/apr.h)
-WITH_APACHE2= YES
-MAKEFILE= Makefile.AP2
-USE_REINPLACE= YES
-MAKE_ARGS= INCLUDES=-I${PREFIX}/include/apache2
-INSTALL_TARGET= install-modules
-PLIST_SUB= APACHE=2
-.else
-PLIST_SUB= APACHE=
-.endif
-
-.if defined(WITHOUT_APACHE_SUEXEC)
-APXSOPTS+= -DNO_SUEXEC_FOR_AP_USER_N_GROUP
-.endif
-
-do-patch:
-.if defined(WITH_APACHE2)
- @${REINPLACE_CMD} -e "s|/usr/local/apache2|${PREFIX}/share/apache2|g" ${WRKSRC}/${MAKEFILE}
-.else
- cd ${WRKSRC} ; ${MV} Makefile.tmpl Makefile ;
-
-do-build:
- cd ${WRKSRC} ; ${LOCALBASE}/sbin/apxs -o mod_fastcgi.so -c ${APXSOPT} *.c
-
-do-install:
- cd ${WRKSRC} ; ${LOCALBASE}/sbin/apxs -i -a -n fastcgi mod_fastcgi.so
-.endif
+USE_APACHE= 1.3+
+AP_FAST_BUILD= yes
+AP_GENPLIST= yes
+SRC_FILE= *.c
+PORTDOCS= LICENSE.TERMS mod_fastcgi.html
post-install:
.if !defined(NOPORTDOCS)
- @${MKDIR} ${DOCSDIR}
-.for file in LICENSE.TERMS mod_fastcgi.html
- ${INSTALL_DATA} ${WRKSRC}/docs/${file} ${DOCSDIR}
+ ${MKDIR} ${DOCSDIR}
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/docs/${f} ${DOCSDIR}
.endfor
.endif
- @${ECHO_MSG} "************************************************************"
-.if !defined(WITH_APACHE2)
- @${ECHO_MSG} "* Fast-cgi modules was included with your apache *"
- @${ECHO_MSG} "* configuration file *"
- @${ECHO_MSG} "* *"
-.endif
- @${ECHO_MSG} "* You need to add following lines to your apache *"
- @${ECHO_MSG} "* configuration file. and restart it ! *"
- @${ECHO_MSG} "* *"
-.if defined(WITH_APACHE2)
- @${ECHO_MSG} "* LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so *"
-.endif
- @${ECHO_MSG} "* AddHandler fastcgi-script fcgi fcgi fpl *"
- @${ECHO_MSG} "* *"
- @${ECHO_MSG} "************************************************************"
-
-.include
+.include
diff -burN /usr/ports/www/mod_fastcgi/files/patch-apache22 mod_fastcgi/files/patch-apache22
--- /usr/ports/www/mod_fastcgi/files/patch-apache22 Thu Jan 1 01:00:00 1970
+++ mod_fastcgi/files/patch-apache22 Sun Jan 1 22:22:35 2006
@@ -0,0 +1,43 @@
+Originally from
+
http://fastcgi.com/archives/fastcgi-developers/2005-December/004060.html
+
+diff -ruN mod_fastcgi-2.4.2/fcgi.h mod_fastcgi-2.4.2-ap22/fcgi.h
+--- fcgi.h 2003-02-04 00:07:37.000000000 +0100
++++ fcgi.h 2005-12-07 21:05:55.000000000 +0100
+@@ -73,6 +73,36 @@
+ #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
diff -burN /usr/ports/www/mod_fastcgi/pkg-plist mod_fastcgi/pkg-plist
--- /usr/ports/www/mod_fastcgi/pkg-plist Thu Jun 19 16:41:36 2003
+++ mod_fastcgi/pkg-plist Thu Jan 1 01:00:00 1970
@@ -1,4 +0,0 @@
-libexec/apache%%APACHE%%/mod_fastcgi.so
-%%PORTDOCS%%%%DOCSDIR%%/LICENSE.TERMS
-%%PORTDOCS%%%%DOCSDIR%%/mod_fastcgi.html
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
注:复制上来有点乱,不知道能不能用。不能用的话请到下面地址获取(前提:能穿过GCD的封锁)
http://www.freebsd.org/cgi/query-pr.cgi?pr=91190
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/13584/showart_72240.html |
|