Skip to content

Commit 117f0af

Browse files
committed
Fix SSL, finally
1 parent 01f25b2 commit 117f0af

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

compile.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ else
454454
exit 1
455455
elif [ -z "$CFLAGS" ]; then
456456
if [ `getconf LONG_BIT` == "64" ]; then
457+
COMPILE_TARGET="linux64"
457458
write_out "INFO" "Compiling for current machine using 64-bit"
458459
if [ "$(uname -m)" != "aarch64" ]; then
459460
CFLAGS="-m64 $CFLAGS"
@@ -1152,6 +1153,32 @@ get_github_extension "arraydebug" "$EXT_ARRAYDEBUG_VERSION" "pmmp" "ext-arraydeb
11521153

11531154
get_github_extension "encoding" "$EXT_ENCODING_VERSION" "pmmp" "ext-encoding"
11541155

1156+
cafile=""
1157+
if [[ "$COMPILE_TARGET" == "mac"* ]]; then
1158+
cafile="/etc/ssl/cert.pem"
1159+
elif [[ "$COMPILE_TARGET" == "linux"* ]] && [[ "$IS_CROSSCOMPILE" != "yes" ]]; then
1160+
#try to detect the correct location from the current system
1161+
for file in \
1162+
"$SSL_CERT_FILE" \
1163+
"/etc/ssl/certs/ca-certificates.crt" \
1164+
"/etc/pki/tls/certs/ca-bundle-crt" \
1165+
"/etc/ssl/cert.pem";
1166+
do
1167+
if [ -f "$file" ]; then
1168+
cafile="$file"
1169+
break
1170+
fi
1171+
done
1172+
else
1173+
echo "wtf $COMPILE_TARGET"
1174+
fi
1175+
if [ -z "$cafile" ]; then
1176+
write_out "WARNING" "Don't know where to find SSL CA bundle for this target; PHP code won't be able to safely access https:// links unless openssl.cafile is configured to the correct path in php.ini"
1177+
else
1178+
write_out "INFO" "System SSL CA bundle detected as $cafile; if this is not correct, please adjust openssl.cafile in php.ini"
1179+
1180+
fi
1181+
11551182
write_library "PHP" "$PHP_VERSION"
11561183

11571184
write_configure
@@ -1357,6 +1384,9 @@ echo "error_reporting=-1" >> "$INSTALL_DIR/bin/php.ini"
13571384
echo "display_errors=1" >> "$INSTALL_DIR/bin/php.ini"
13581385
echo "display_startup_errors=1" >> "$INSTALL_DIR/bin/php.ini"
13591386
echo "recursionguard.enabled=0 ;disabled due to minor performance impact, only enable this if you need it for debugging" >> "$INSTALL_DIR/bin/php.ini"
1387+
if [ -n "$cafile" ]; then
1388+
echo "openssl.cafile=$cafile" >> "$INSTALL_DIR/bin/php.ini"
1389+
fi
13601390

13611391
if [ "$HAVE_OPCACHE" == "yes" ]; then
13621392
if [ "$PHP_VERSION_ID" -lt 80500 ]; then

0 commit comments

Comments
 (0)