Skip to content

Commit b3ba4fb

Browse files
committed
Convert PHP config setup to much simpler CLI arguments
1 parent af1b376 commit b3ba4fb

File tree

3 files changed

+12
-124
lines changed

3 files changed

+12
-124
lines changed

src/interceptors/terminal-wrappers/build-php-config.php

Lines changed: 0 additions & 111 deletions
This file was deleted.

src/interceptors/terminal-wrappers/php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ set -e
44
# Exclude ourselves from PATH within this script, to avoid recursing
55
PATH="${PATH/`dirname $0`:/}"
66

7-
# Build a new PHP config that trusts our certificate, and use PHPRC
8-
# to ensure that the next php command uses it.
9-
export PHPRC=`php $(dirname $0)/build-php-config.php`
10-
11-
# Pass everything through to PHP (but now using our tweaked config)
12-
php "$@"
7+
# Call PHP with the given arguments, and a few extra
8+
PHP_ARGS=(
9+
# Make OpenSSL trust us
10+
-d "openssl.cafile=$SSL_CERT_FILE" \
11+
# Make cURL trust us
12+
-d "curl.cainfo=$SSL_CERT_FILE" \
13+
# Pass through all other provided arguments
14+
"$@"
15+
)
16+
php ${PHP_ARGS[@]}

src/interceptors/terminal-wrappers/php.bat

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,5 @@ set WRAPPER_FOLDER=%THIS_PATH:~0,-1%
1010
REM Remove that folder from PATH
1111
call set PATH=%%PATH:%WRAPPER_FOLDER%;=%%
1212

13-
REM Create a php.ini that trusts our cert, and set the path in PHPRC so PHP uses it
14-
FOR /F "tokens=* USEBACKQ" %%F IN (`php %WRAPPER_FOLDER%\build-php-config.php`) DO (
15-
SET PHPRC=%%F
16-
)
17-
18-
REM Start PHP for real (but now using our tweaked config)
19-
php %*
13+
REM Start PHP for real, with extra args to override certain configs
14+
php -d "openssl.cafile=%SSL_CERT_FILE%" -d "curl.cainfo=%SSL_CERT_FILE%" %*

0 commit comments

Comments
 (0)