Getting PHP5.6 and MySql to Play Nice On Arm64 RockChip Gentoo

This blog used to live on a heathen VPS until the limitations of using a toy-server were finally felt. As luck would have it, I had just procured a spiffy new Rockchip from Pizarro ISP, so off I set to resurrect lobbesblog on this beautiful Gentoo arm64 box.

I'm absolutely a Gentoo n00b, but I was able to get 'AM' portions of LAMP emerged without too much trouble, and 'P' with help from BingoBoingo's helpful guide. The problem I ran into, however, was getting the 'M' and the 'P' playing nice. Specifically: Portage would not emerge the 'mysql module' for php no matter how hard I typed 'mysql' for the USE flags in make.conf and/or package.use.

The path to my solution was revealed once I paid attention to a specific piece of the problem output:

pizrk003 blog # emerge --ask dev-lang/php:5.6

* IMPORTANT: 4 news items need reading for repository 'gentoo'.

* Use eselect news read to view new items.

* Last emerge --sync was 47d 12h 28m 3s ago.

* IMPORTANT: config file '/etc/portage/package.use' needs updating.

* See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS

* sections of the emerge man page to learn how to update config files.

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild     UD ] dev-libs/oniguruma-6.7.1 [6.8.1] USE="-combination-explosion-check%"

[ebuild  NS    ] dev-lang/php-5.6.35-r1 [7.2.4] USE="acl apache2 berkdb bzip2 cgi cli crypt ctype fileinfo filter fpm gdbm hash iconv ipv6 json mysqli nls opcache phar posix readline session simplexml ssl tokenizer unicode xml zlib -bcmath -calendar -cdb -cjk -coverage -curl -debug -embed -enchant -exif (-firebird) -flatfile -ftp -gd -gmp -imap -inifile -intl -iodbc (-kerberos) (-ldap) (-ldap-sasl) -libedit -libmysqlclient -libressl -mhash (-mssql) (-mysql) (-oci8-instant-client) -odbc -pcntl -pdo -postgres (-qdbm) -recode (-selinux) -sharedmem -snmp -soap -sockets -spell -sqlite -sybase-ct -systemd -sysvipc -threads -tidy -truetype (-vpx) -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xslt -zip"

"Hey, so what the hell do those brackets mean?" was the question I asked myself that eventually led me to the promised lands of a functioning Gentoo arm64 LAMP. Some light querying of the Gentoo forums illuminated the path for me:

"In short, they mean forced, masked, or removed (also mentioned on man emerge)."

Yeah, okay, I failed to rtfm. Nevertheless, some digging in /usr/portage/profiles/arch/arm64/use.mask confirmed:

lobbes@pizrk003 ~ $ cat /usr/portage/profiles/arch/arm64/use.mask | grep 'mysql' -B 30

[ snip ]

# havent tested yet

ruby

ctypes-python

sasl

libproxy

pkcs11

bazaar

darcs

mercurial

kerberos

gpg

gnome

doc

emacs

gphoto2

afs

mono

lirc

lm_sensors

xemacs

rpm

scanner

zvbi

ldap

mysql

Aha! There's our culprit. The comment states it was masked due to it being untested1 so we are free to do some testing ourselves as far as I'm concerned.

The Gentoo wiki says the best way to unmask is to edit /etc/portage/profile/use.mask, so let's listen to it and add something like the following:

# Unmask mysql

-mysql

Now try emerging once more:

pizrk003 profile # emerge --ask dev-lang/php:5.6

* IMPORTANT: 4 news items need reading for repository 'gentoo'.

* Use eselect news read to view new items.

* Last emerge --sync was 66d 7h 27m 55s ago.

* IMPORTANT: config file '/etc/portage/package.use' needs updating.

* See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS

* sections of the emerge man page to learn how to update config files.

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] dev-lang/php-5.6.35-r1  USE="mysql* -mysqli*"

Would you like to merge these packages? [Yes/No] yes

Why hello mysql!2 After the ebuild finished successfully I gave equery a query:

pizrk003 profile # equery u dev-lang/php-5.6.35-r1

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

* Found these USE flags for dev-lang/php-5.6.35-r1:

U I

[...snip...]

- - libmysqlclient : Use libmyslclient driver for mysql, mysqli, PDO_Mysql (not recommended)

- - libressl       : Use dev-libs/libressl instead of dev-libs/openssl as SSL/TLS provider (ineffective with USE=-ssl), packages should not depend on this USE

flag

- - mhash          : Add support for the mhash library

+ + mysql          : Add mySQL Database support

Well hot diggity dog! One quick apache restart later confirms php mysql module is indeed functioning. Victory.

  1. vs. "known to cause massive breakages and anal fissures" []
  2. and goodbye mysqli []

Leave a Reply