diff options
-rw-r--r-- | auto/modules/php | 33 | ||||
-rw-r--r-- | src/nxt_php_sapi.c | 6 |
2 files changed, 36 insertions, 3 deletions
diff --git a/auto/modules/php b/auto/modules/php index 75d60242..0ba82eae 100644 --- a/auto/modules/php +++ b/auto/modules/php @@ -59,6 +59,12 @@ NXT_PHP_MODULE=${NXT_PHP_MODULE=${NXT_PHP##*/}} NXT_PHP_LIB_PATH=${NXT_PHP_LIB_PATH=} NXT_PHP_LIB_STATIC=${NXT_PHP_LIB_STATIC=no} NXT_PHP_ADDITIONAL_FLAGS= +NXT_PHP_REALPATH=realpath + + +if [ -z `which $NXT_PHP_REALPATH` ]; then + NXT_PHP_REALPATH="readlink -e" +fi $echo "configuring PHP module" @@ -74,6 +80,14 @@ if /bin/sh -c "${NXT_PHP_CONFIG} --version" >> $NXT_AUTOCONF_ERR 2>&1; then $echo " found" NXT_PHP_VERSION="`${NXT_PHP_CONFIG} --version`" + NXT_PHP_EXT_DIR="`${NXT_PHP_CONFIG} --extension-dir`" + NXT_PHP_LIBC_DIR="`${CC} --print-file-name=libc.so`" + NXT_PHP_LIBC_DIR="`$NXT_PHP_REALPATH $NXT_PHP_LIBC_DIR`" + NXT_PHP_LIBC_DIR="`dirname $NXT_PHP_LIBC_DIR`" + NXT_PHP_SYSLIB_DIR="`${CC} --print-file-name=libtinfo.so`" + NXT_PHP_SYSLIB_DIR="`$NXT_PHP_REALPATH $NXT_PHP_SYSLIB_DIR`" + NXT_PHP_SYSLIB_DIR="`dirname $NXT_PHP_SYSLIB_DIR`" + $echo " + PHP SAPI: [`${NXT_PHP_CONFIG} --php-sapis`]" NXT_PHP_MAJOR_VERSION=${NXT_PHP_VERSION%%.*} @@ -213,6 +227,22 @@ if grep ^$NXT_PHP_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then exit 1; fi + +NXT_PHP_MOUNTS_HEADER=nxt_${NXT_PHP_MODULE}_mounts.h + +cat << END > $NXT_BUILD_DIR/$NXT_PHP_MOUNTS_HEADER +static const nxt_fs_mount_t nxt_php_mounts[] = { + {(u_char *) "$NXT_PHP_EXT_DIR", (u_char *) "$NXT_PHP_EXT_DIR", + (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, + {(u_char *) "$NXT_PHP_LIBC_DIR", (u_char *) "$NXT_PHP_LIBC_DIR", + (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, + {(u_char *) "$NXT_PHP_SYSLIB_DIR", (u_char *) "$NXT_PHP_SYSLIB_DIR", + (u_char *) "bind", NXT_MS_BIND | NXT_MS_REC, NULL}, +}; + +END + + $echo " + PHP module: ${NXT_PHP_MODULE}.unit.so" . auto/cc/deps @@ -238,7 +268,8 @@ for nxt_src in $NXT_PHP_MODULE_SRCS; do cat << END >> $NXT_MAKEFILE $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H - \$(CC) -c \$(CFLAGS) $NXT_PHP_ADDITIONAL_FLAGS \$(NXT_INCS) \\ + \$(CC) -c \$(CFLAGS) -DNXT_PHP_MOUNTS_H=\"$NXT_PHP_MOUNTS_HEADER\" \\ + $NXT_PHP_ADDITIONAL_FLAGS \$(NXT_INCS) \\ $NXT_PHP_INCLUDE -DNXT_ZEND_SIGNAL_STARTUP=$NXT_ZEND_SIGNAL_STARTUP \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c index bc8341f4..d7e5b476 100644 --- a/src/nxt_php_sapi.c +++ b/src/nxt_php_sapi.c @@ -14,6 +14,8 @@ #include <nxt_unit.h> #include <nxt_unit_request.h> +#include NXT_PHP_MOUNTS_H + #if PHP_VERSION_ID >= 50400 #define NXT_HAVE_PHP_IGNORE_CWD 1 @@ -250,8 +252,8 @@ NXT_EXPORT nxt_app_module_t nxt_app_module = { compat, nxt_string("php"), PHP_VERSION, - NULL, - 0, + nxt_php_mounts, + nxt_nitems(nxt_php_mounts), NULL, nxt_php_start, }; |