Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable mysql extension in PHP #1025

Closed
wants to merge 15 commits into from
Closed

Conversation

Neo-Oli
Copy link
Member

@Neo-Oli Neo-Oli commented May 17, 2017

Since mariadb isn't available on arm yet, this is going to cause some issues. But on aarch64 it works well already. I tested it with a wordpress and a typo3 installation.

@vishalbiswas
Copy link
Contributor

You need to conditionally enable it for "$TERMUX_ARCH" != "arm"
Otherwise, build will fail on for arm.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented May 18, 2017

@vishalbiswas right, but how do I disable subpackages? As far as I can tell TERMUX_SUBPKG_BLACKLISTED_ARCHES isn't honored.

@fornwall
Copy link
Member

Hopefully the next NDK release, Release: Late May/Early June 2017 as stated here, will allow us to enable mariadb also for 32-bit arches, so we can proabably await that one before enabling this.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented May 18, 2017

Hmm there still seems to be a problem with this as it can't actually load pdo_mysql.

[18-May-2017 15:02:06] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/data/data/com.termux/files/usr/lib/php/pdo_mysql.so' - dlopen failed: cannot locate symbol "mysql_get_client_info" referenced
 by "/data/data/com.termux/files/usr/lib/php/pdo_mysql.so"... in Unknown on line 0

@vishalbiswas any ideas?

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jun 26, 2017

I've been using it for month now without problems, but since the mariadb update to 10.2.6, php sometimes Segfaults when connecting to large databases. I've seen this issue come up with Typo3 instances.

WARNING: [pool www] child 5574 exited on signal 11 (SIGSEGV - core dumped) after 1.226751 seconds from start

I'm not sure what could cause the problem

@fornwall
Copy link
Member

@Neo-Oli Does rebuilding the extension against mariadb 10.2.6 and installing fix the problem, or does it remain?

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jun 26, 2017

@fornwall It remains. I actually had to change the patch to get it to work at all. It seems that the older version provided libmysqlclient.so while the new one provides libmariadb.so.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jun 26, 2017

Finally managed to grab a stack trace by running php as it's own server.

Program received signal SIGSEGV, Segmentation fault.
0x0000007fb6f3f9f8 in zif_mysqli_stmt_bind_result ()
   from /data/data/com.termux/files/usr/lib/php/mysqli.so
(gdb) bt
#0  0x0000007fb6f3f9f8 in zif_mysqli_stmt_bind_result ()
   from /data/data/com.termux/files/usr/lib/php/mysqli.so
#1  0x00000030004095f4 in zend_call_function ()
#2  0x000000300034c124 in zif_call_user_func_array ()
#3  0x00000030004be040 in ?? ()
#4  0x0000003000a59000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jun 26, 2017

I tried compiling php with debug symbols enabled but that just gives me

/tmp/cc69damn.s: Assembler messages:
/tmp/cc69damn.s:10097: Error: operand 2 should be an integer register -- `mul x2,[x29,464],[x29,456]'
/tmp/cc69damn.s:10098: Error: operand 2 should be an integer register -- `smulh x1,[x29,464],[x29,456]'
/tmp/cc69damn.s:10173: Error: operand 2 should be an integer register -- `mul x2,[x29,456],[x29,456]'
/tmp/cc69damn.s:10174: Error: operand 2 should be an integer register -- `smulh x1,[x29,456],[x29,456]'
Makefile:1907: recipe for target 'Zend/zend_operators.lo' failed
make: *** [Zend/zend_operators.lo] Error 1
make: *** Waiting for unfinished jobs....

during compilation

@fornwall
Copy link
Member

@Neo-Oli Can you try again with the updated php package at version 7.1.7? This contains a backported aarch64 php bug fix, php/php-src@8c86792, concerning inline assembly for long multiplication, so it may be related.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jul 10, 2017

@fornwall Unfortunately I am currently struggling compiling pdo_mysql and mysqli because in the last version of mariadb libmysqlclient got renamed to libmariadb and this seems to be incompatible with pdo_mysql and mysqli. Previously the lib was $PREFIX/lib/libmysqlclient.so and now it is $PREFIX/lib/libmariadb.so. Do you know anything about this change? I can't really find anything about this in the changelogs of mariadb and it seems to be quite a big change. Wasn't the point of mariadb that it was a drop-in replacement?

@vishalbiswas
Copy link
Contributor

libmysqlclient is now built static. So, you'll need to build mariadb yourself to get libmysqlclient.a as it isn't included in mariadb's deb (sorry for that tip, didn't know about it) file.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jul 17, 2017

@vishalbiswas I added your patch and then did it again for the current version of php. After that didn't work I replaced some more instances of mysqlclient with mariadb, but I'm still getting:

checking for mysql_set_server_option in -lmariadb_r... no
configure: error: wrong mysql library version or lib not found. Check config.log for more information.

@Neo-Oli
Copy link
Member Author

Neo-Oli commented Jul 17, 2017

I also tried it with removing the patch and adding a symlink for libmysqlclient.so but I get the same error.

@vishalbiswas Do you want to give packaging this a try? I'm not in it for the glory and don't mind if it isn't my name in the commit ;). I am also rather short on time the next couple of weeks.

@vishalbiswas
Copy link
Contributor

Can be closed now. I created #1763

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants