Skip to content

Commit

Permalink
Add missing functions required to succesfully connect with MySQL DB (#…
Browse files Browse the repository at this point in the history
…1752)

## Motivation for the change, related issues

When trying to connect to a MySQL database (in my case version 8.4.0)
several errors regarding unreachable code were triggered, making the
site unusable.

I've added the required functions one by one until there were no more
errors and I was able to successfully run a site with MySQL.

The errors seem to be related to how MySQL handles authentication
specifically.

## Implementation details

I did not yet run a full build as I am not sure if there are any
additional steps needed to do that. I would appreciate some help with
this.

## Testing Instructions (or ideally a Blueprint)

- Run a MySQL database with Docker (use latest)
- Remove SQLite integration plugin from WordPress Playground site and
change wp-config.php to point to `127.0.0.1` and provide valid db
credentials.
- Observe that trying to use the MySQL db with a Playground site causes
errors.
- Build a new wasm binary and use it (and the accompanying js file) with
the Playground site.
- Observe that now the site works with MySQL.
  • Loading branch information
jeroenpf authored Sep 24, 2024
1 parent b81c81d commit 8988ad3
Show file tree
Hide file tree
Showing 55 changed files with 33 additions and 27 deletions.
6 changes: 6 additions & 0 deletions packages/php-wasm/compile/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ RUN echo -n ' -s ASYNCIFY=1 -s ASYNCIFY_IGNORE_INDIRECT=1 ' >> /root/.emcc-php-w
"do_cli",\
"do_cli_server",\
"execute_ex",\
"EVP_PKEY_encrypt",\
"list_entry_destructor",\
"main",\
"mysql_handle_begin",\
Expand All @@ -657,6 +658,7 @@ RUN echo -n ' -s ASYNCIFY=1 -s ASYNCIFY_IGNORE_INDIRECT=1 ' >> /root/.emcc-php-w
"mysql_stmt_execute",\
"mysqli_commit_or_rollback_libmysql",\
"mysqli_common_connect",\
"mysqlnd_caching_sha2_handle_server_response",\
"mysqlnd_com_handshake_run",\
"mysqlnd_com_init_db_run",\
"mysqlnd_com_stmt_execute_run",\
Expand Down Expand Up @@ -718,6 +720,7 @@ RUN echo -n ' -s ASYNCIFY=1 -s ASYNCIFY_IGNORE_INDIRECT=1 ' >> /root/.emcc-php-w
"php_fsockopen_stream",\
"php_getimagesize_from_any",\
"php_mysqlnd_auth_response_read",\
"php_mysqlnd_cached_sha2_result_read",\
"php_mysqlnd_cmd_write",\
"php_mysqlnd_conn_connect_pub",\
"php_mysqlnd_conn_data_connect_handshake_pub",\
Expand Down Expand Up @@ -748,6 +751,7 @@ RUN echo -n ' -s ASYNCIFY=1 -s ASYNCIFY_IGNORE_INDIRECT=1 ' >> /root/.emcc-php-w
"php_mysqlnd_rowp_read",\
"php_mysqlnd_rset_field_read",\
"php_mysqlnd_rset_header_read",\
"php_mysqlnd_sha256_pk_request_response_read",\
"php_mysqlnd_stmt_execute_pub",\
"php_mysqlnd_stmt_prepare_pub",\
"php_network_accept_incoming",\
Expand All @@ -773,10 +777,12 @@ RUN echo -n ' -s ASYNCIFY=1 -s ASYNCIFY_IGNORE_INDIRECT=1 ' >> /root/.emcc-php-w
"php_stream_xport_crypto_enable",\
"php_stream_xport_crypto_setup",\
"php_tcp_sockop_set_option",\
"pkey_rsa_encrypt",\
"preg_replace_func_impl",\
"readline_shell_run",\
"reflection_method_invoke",\
"run_cli",\
"RSA_padding_add_PKCS1_OAEP_mgf1",\
"user_shutdown_function_call",\
"shutdown_executor",\
"shutdown_destructors",\
Expand Down
Loading

0 comments on commit 8988ad3

Please sign in to comment.