MySQL Enterprise Connector/PHP Plugin for php 5.4 [closed]

Posted on

Question :

I’m trying to setup mysqlenterprise.so. I have installed the native driver and loaded before mysqlent, but when I try to start it I got:

Starting php-fpm: [14-Jul-2015 14:27:40] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqlenterprise.so' - /usr/lib64/php/modules/mysqlenterprise.so: undefined symbol: php_body_write in Unknown on line 0

I have googled and found the error undefined symbol: php_body_write in Unknown on line 0 for other php modules that got solved upgrading the module.

Is it possible to load this mysqlenterprise.so into php 5.4? Documentation says that i need a minimal version of 5.3.

So far I got:
Config files:

ls -la /etc/php.d/
total 96
drwxr-xr-x.  2 root root 4096 Jul 15 20:35 .
drwxr-xr-x. 87 root root 4096 Jul 15 18:21 ..
-rw-r--r--.  1 root root   49 Jun 15 09:46 curl.ini
(omitted output)
-rw-r--r--.  1 root root   55 Jun 15 09:46 mysqlnd.ini
-rw-r--r--.  1 root root   69 Jun 15 09:46 mysqlnd_mysqli.ini
-rw-r--r--.  1 root root   67 Jun 15 09:46 mysqlnd_mysql.ini
(omitted output)
-rw-r--r--.  1 root root   29 Jul 15 20:35 zzmysqlenterprise.ini

Loaded modules

ls /usr/lib64/php/modules/mysqlenterprise.so 
/usr/lib64/php/modules/mysqlenterprise.so

Config file contents:

cat /etc/php.d/zzmysqlenterprise.ini
extension=mysqlenterprise.so

With @mim help now I know that php 5.3 vs 5.4 changed on output.c symbol php_body_write in favour to php_output_write (why? why broke like this the libs compat?)

https://github.com/php/php-src/blob/PHP-5.4.42/main/output.c
vs
https://github.com/php/php-src/blob/PHP-5.3.29/main/output.c

nm /usr/lib64/php/modules/mysqlenterprise.so | grep php
                 U _php_stream_free
                 U _php_stream_get_line
                 U _php_stream_read
                 U _php_stream_write
                 U _php_stream_xport_create
                 U php_base64_encode
                 U php_body_write
                 U php_error_docref0
                 U php_info_print_table_end
                 U php_info_print_table_header
                 U php_info_print_table_row
                 U php_info_print_table_start
0000000000006d42 t php_mysqlenterprise_conn_change_user_pub
0000000000006e8c t php_mysqlenterprise_conn_close_pub
0000000000006e4a t php_mysqlenterprise_conn_end_psession_pub
0000000000006e6b t php_mysqlenterprise_conn_free_contents_pub
0000000000006cbd t php_mysqlenterprise_conn_kill_connection_pub
0000000000006c90 t php_mysqlenterprise_conn_ping_pub
0000000000006b76 t php_mysqlenterprise_conn_query_pub
0000000000006cf9 t php_mysqlenterprise_conn_select_db_pub
0000000000002659 t php_mysqlenterprise_init_globals
                 U php_sprintf
                 U php_stream_xport_get_name

I’m having trouble opening Oracle support case, but I’m suspecting is incompatible or there are newer versions from them.

Answer :

Now a little update:

I tried mysqlenterprise.so for php 5.4, 5.5 and 5.6 and i’m sure it won’t work cause it’s a compatibility issue.

In PHP Plugin Pack 3.0.22 there’s only mysql-enterprise-plugin-1.0.1-php5.3 and unfortunately it works only on php 5.3. It caused by the change of php_body_write to php_output_write on PHPAPI main/output.c after 5.4 release. I checked if there’s a new extension but can not find anything.

Only solution seems to open a support ticket.


As shown in documentation you need to load your mysqlnd before mysqlenterprise.so. Mostly this error is about wrong configuration or choosing wrong version for extensions.

Did you compile your php enabled with mysqlnd or installed mysqlnd extension?

First check your php configuration on command line with php -i for controlling your extensions loaded successfully.
You can read more clean you grep result with mysql and check your extension list with grep -Hrv ";" /etc/php.d/ | grep -i "extension="

/etc/php.d directory can be different in different installations.

If you can’t see your extensions details, check your php configuration ini files under extension folderand make sure you have mysqlnd.ini. For mysql enterprise ini file, you can create one mysqlzz_enterprise.ini or just add it in mysqlnd.ini file.

If this not solve your problem, try to uninstall php and make sure you installed mysqlnd, then add your extension to your ini file, check your extension ini files as in documentation tells.

Example configure options for php source build:

./configure --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd

Leave a Reply

Your email address will not be published. Required fields are marked *