Skip to content

Commit 4c27b0d

Browse files
committed
Simplify ext/mysqlnd extended SSL configuration
Making this option to be `ON` by default, makes using mysqlnd extension much, much easier in reality. Having extended SSL support in mysqlnd disabled is not a real-world case scenario. Specially, with MySQL Server 8.0+ where `caching_sha2_password` wouldn't work. And to also not worry about whether the ext/openssl has been enabled during the PHP build or not.
1 parent d8cf377 commit 4c27b0d

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

cmake/ext/mysqlnd/CMakeLists.txt

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ Enable compressed protocol support in mysqlnd.
2929
3030
## PHP_EXT_MYSQLND_SSL
3131
32-
* Default: `OFF`
32+
* Default: `ON`
3333
* Values: `ON|OFF`
3434
35-
Explicitly enable extended SSL support in the `mysqlnd` extension. On \*nix
36-
systems, extended SSL works through the OpenSSL library and on Windows through
37-
the Windows Crypt32 library. Beneficial when building without the `openssl`
38-
extension or when building with phpize.
35+
Explicitly enable or disable extended SSL support in the `mysqlnd` extension. On
36+
\*nix systems, the extended SSL works through the OpenSSL library and on Windows
37+
through the Windows Crypt32 library.
3938
40-
\*nix systems: when building with the `openssl` extension (`PHP_EXT_OPENSSL=ON`)
41-
in the php-src tree, the extended SSL is enabled implicitly regardless of this
42-
option.
39+
For example, `mysqlnd` extension with disabled extended SSL support, would
40+
require in MySQL Server 8.0 and later versions to have the
41+
`default_authentication_plugin` configuration set to `mysql_native_password` in
42+
`my.cnf` (`caching_sha2_password` therefore wouldn't be supported).
4343
44-
Windows systems: extended SSL is enabled implicitly based on the Crypt32
45-
library regardless of this option.
44+
This option is only provided to explicitly avoid requiring the OpenSSL
45+
dependency, otherwise recommended setting is `ON`.
4646
#]=============================================================================]
4747

4848
cmake_minimum_required(VERSION 3.25...3.31)
@@ -89,8 +89,8 @@ cmake_dependent_option(
8989
PHP_EXT_MYSQLND_SSL
9090
"Explicitly enable extended SSL support in the mysqlnd extension through\
9191
OpenSSL system library (*nix) or Crypt32 (Windows)."
92-
OFF
93-
[[PHP_EXT_MYSQLND AND NOT PHP_EXT_OPENSSL AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"]]
92+
ON
93+
"PHP_EXT_MYSQLND"
9494
OFF
9595
)
9696

@@ -185,13 +185,7 @@ endif()
185185

186186
set(MYSQLND_SSL_SUPPORTED TRUE)
187187

188-
if(
189-
(
190-
NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"
191-
AND (PHP_EXT_MYSQLND_SSL OR PHP_EXT_OPENSSL)
192-
)
193-
OR CMAKE_SYSTEM_NAME STREQUAL "Windows"
194-
)
188+
if(PHP_EXT_MYSQLND_SSL)
195189
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
196190
target_link_libraries(php_ext_mysqlnd PRIVATE crypt32)
197191
else()
@@ -200,7 +194,7 @@ if(
200194
OpenSSL
201195
PROPERTIES
202196
TYPE REQUIRED
203-
PURPOSE "Necessary to enable SSL in the mysqlnd extension."
197+
PURPOSE "Necessary to enable extended SSL in the mysqlnd extension."
204198
)
205199
target_link_libraries(php_ext_mysqlnd PRIVATE OpenSSL::Crypto)
206200
endif()

0 commit comments

Comments
 (0)