summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index d2494938..0358ebdf 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -106,6 +106,8 @@ static nxt_int_t nxt_php_do_301(nxt_unit_request_info_t *req);
static void nxt_php_request_handler(nxt_unit_request_info_t *req);
static void nxt_php_dynamic_request(nxt_php_run_ctx_t *ctx,
nxt_unit_request_t *r);
+static void nxt_zend_stream_init_filename(zend_file_handle *handle,
+ const char *filename);
static void nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r);
nxt_inline void nxt_php_vcwd_chdir(nxt_unit_request_info_t *req, u_char *dir);
@@ -1110,6 +1112,21 @@ nxt_php_dynamic_request(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
static void
+nxt_zend_stream_init_filename(zend_file_handle *handle, const char *filename)
+{
+ nxt_memzero(handle, sizeof(zend_file_handle));
+
+ handle->type = ZEND_HANDLE_FILENAME;
+#if (PHP_VERSION_ID >= 80100)
+ handle->filename = zend_string_init(filename, strlen(filename), 0);
+ handle->primary_script = 1;
+#else
+ handle->filename = filename;
+#endif
+}
+
+
+static void
nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
{
#if (PHP_VERSION_ID < 50600)
@@ -1179,16 +1196,8 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
nxt_php_vcwd_chdir(ctx->req, ctx->script_dirname.start);
}
- nxt_memzero(&file_handle, sizeof(file_handle));
-
- file_handle.type = ZEND_HANDLE_FILENAME;
-#if (PHP_VERSION_ID >= 80100)
- file_handle.filename = zend_string_init((char *) ctx->script_filename.start,
- ctx->script_filename.length, 0);
- file_handle.primary_script = 1;
-#else
- file_handle.filename = (char *) ctx->script_filename.start;
-#endif
+ nxt_zend_stream_init_filename(&file_handle,
+ (const char *) ctx->script_filename.start);
php_execute_script(&file_handle TSRMLS_CC);