From b873516e6a025f9f139bca1309b53097596ce533 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 5 Apr 2019 15:10:08 -0700 Subject: [PATCH] PHP: fix windows build --- src/php/bin/run_tests.sh | 7 ++++--- src/php/ext/grpc/php_grpc.c | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index 49fd84514c1..a78dd259e2f 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -22,16 +22,17 @@ cd src/php/bin source ./determine_extension_dir.sh # in some jenkins macos machine, somehow the PHP build script can't find libgrpc.dylib export DYLD_LIBRARY_PATH=$root/libs/$CONFIG -php $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ +$(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ --exclude-group persistent_list_bound_tests ../tests/unit_tests -php $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ +$(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ ../tests/unit_tests/PersistentChannelTests export ZEND_DONT_UNLOAD_MODULES=1 export USE_ZEND_ALLOC=0 # Detect whether valgrind is executable if [ -x "$(command -v valgrind)" ]; then - valgrind --error-exitcode=10 --leak-check=yes php $extension_dir -d max_execution_time=300 \ + $(which valgrind) --error-exitcode=10 --leak-check=yes \ + $(which php) $extension_dir -d max_execution_time=300 \ ../tests/MemoryLeakTest/MemoryLeakTest.php fi diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 3064563d03f..f6c2f85ed47 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -205,11 +205,15 @@ void register_fork_handlers() { void apply_ini_settings() { if (GRPC_G(enable_fork_support)) { - setenv("GRPC_ENABLE_FORK_SUPPORT", "1", 1 /* overwrite? */); + putenv("GRPC_ENABLE_FORK_SUPPORT=1"); } if (GRPC_G(poll_strategy)) { - setenv("GRPC_POLL_STRATEGY", GRPC_G(poll_strategy), 1 /* overwrite? */); + char *poll_str = malloc(sizeof("GRPC_POLL_STRATEGY=") + + strlen(GRPC_G(poll_strategy))); + strcpy(poll_str, "GRPC_POLL_STRATEGY="); + strcat(poll_str, GRPC_G(poll_strategy)); + putenv(poll_str); } }