Skip to content

Commit

Permalink
Reimplement FastCGI interface
Browse files Browse the repository at this point in the history
Due to licensing restrictions that actually don't allow anybody to use
the libfcgi code without prior approval from Open Market, which is
impossible to obtain - we decided to reimplement this interface from
scratch.  The result is actually slightly faster, and more importantly,
clear of any copyright issues.

Implementation by Dmitry
  • Loading branch information
zsuraski committed Dec 25, 2005
1 parent 6299d22 commit 91a7355
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
5 changes: 2 additions & 3 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@

#include "php_getopt.h"

#include "fcgi_config.h"
#include "fcgiapp.h"
/* don't want to include fcgios.h, causes conflicts */
#include "fastcgi.h"

#ifdef PHP_WIN32
extern int OS_SetImpersonate(void);
#else
Expand Down
3 changes: 1 addition & 2 deletions sapi/cgi/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
ARG_ENABLE('cgi', 'Build CGI version of PHP', 'yes');

if (PHP_CGI == "yes") {
SAPI('cgi', 'cgi_main.c getopt.c', 'php-cgi.exe', '/I sapi/cgi/libfcgi/include /D FCGI_STATIC');
ADD_SOURCES('sapi/cgi/libfcgi', 'fcgi_stdio.c fcgiapp.c os_win32.c', 'cgi');
SAPI('cgi', 'cgi_main.c getopt.c fastcgi.c', 'php-cgi.exe');
ADD_FLAG('LIBS_CGI', 'ws2_32.lib kernel32.lib advapi32.lib');
}
31 changes: 27 additions & 4 deletions sapi/cgi/config9.m4
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,32 @@ if test "$PHP_SAPI" = "default"; then
if test "$PHP_SAPI_CGI" != "no"; then
AC_MSG_RESULT(yes)

AC_MSG_CHECKING([for socklen_t in sys/socket.h])
AC_EGREP_HEADER([socklen_t], [sys/socket.h],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SOCKLEN_T], [1],
[Define if the socklen_t typedef is in sys/socket.h])],
AC_MSG_RESULT([no]))

AC_MSG_CHECKING([for sun_len in sys/un.h])
AC_EGREP_HEADER([sun_len], [sys/un.h],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
[Define if sockaddr_un in sys/un.h contains a sun_len component])],
AC_MSG_RESULT([no]))

AC_MSG_CHECKING([whether cross-process locking is required by accept()])
case "`uname -sr`" in
IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0)
AC_MSG_RESULT([yes])
AC_DEFINE([USE_LOCKING], [1],
[Define if cross-process locking is required by accept()])
;;
*)
AC_MSG_RESULT([no])
;;
esac

PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
case $host_alias in
*cygwin* )
Expand All @@ -58,11 +84,8 @@ if test "$PHP_SAPI" = "default"; then

PHP_TEST_WRITE_STDOUT

PHP_ADD_BUILD_DIR($abs_builddir/sapi/cgi/libfcgi)
PHP_FCGI_INCLUDE="-I$abs_srcdir/sapi/cgi/libfcgi/include"

INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)\$(EXEEXT)"
PHP_SELECT_SAPI(cgi, program, libfcgi/fcgi_stdio.c libfcgi/fcgiapp.c libfcgi/os_unix.c cgi_main.c getopt.c, $PHP_FCGI_INCLUDE, '$(SAPI_CGI_PATH)')
PHP_SELECT_SAPI(cgi, program, fastcgi.c cgi_main.c getopt.c, '', '$(SAPI_CGI_PATH)')

case $host_alias in
*aix*)
Expand Down

0 comments on commit 91a7355

Please sign in to comment.