Skip to contentSkip to conversation

php: add --enable-mysqlnd to configure options when using mysql extensions

PATCH New Ryan Coe 3 participants 8 messages Sep 7, 2016 – Sep 8, 2016

lore
Share & tools
lore

Ryan Coe

author
#0 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Without this configure option, mysqli was failing to build with my config after commit ea1e9e03442a5b375aa2214ba92e48ebba89070a. The build did not fail, however, I was unable to use mysqli in my application.

---
 package/php/php.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/php/php.mk +2 -2
index deaf56e..766f3df 100644
@@ -181,7 +181,7 @@ endif
 
 ### Native SQL extensions
 ifeq ($(BR2_PACKAGE_PHP_EXT_MYSQLI),y)
-PHP_CONF_OPTS += --with-mysqli
+PHP_CONF_OPTS += --enable-mysqlnd --with-mysqli=mysqlnd
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_SQLITE),y)
 PHP_CONF_OPTS += --with-sqlite3=$(STAGING_DIR)/usr
@@ -198,7 +198,7 @@ PHP_DEPENDENCIES += sqlite
 PHP_CFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),y)
-PHP_CONF_OPTS += --with-pdo-mysql
+PHP_CONF_OPTS += --enable-mysqlnd --with-pdo-mysql=mysqlnd
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL),y)
 PHP_CONF_OPTS += --with-pdo-pgsql=$(STAGING_DIR)/usr
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Floris,

Could you have a look at the below patch?

Thanks!

Thomas

Quoted 31 lines · Ryan Coe

Without this configure option, mysqli was failing to build with my config after commit ea1e9e03442a5b375aa2214ba92e48ebba89070a. The build did not fail, however, I was unable to use mysqli in my application.

---
 package/php/php.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/php/php.mk +2 -2
index deaf56e..766f3df 100644
@@ -181,7 +181,7 @@ endif
 
 ### Native SQL extensions
 ifeq ($(BR2_PACKAGE_PHP_EXT_MYSQLI),y)
-PHP_CONF_OPTS += --with-mysqli
+PHP_CONF_OPTS += --enable-mysqlnd --with-mysqli=mysqlnd
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_SQLITE),y)
 PHP_CONF_OPTS += --with-sqlite3=$(STAGING_DIR)/usr
@@ -198,7 +198,7 @@ PHP_DEPENDENCIES += sqlite
 PHP_CFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_MYSQL),y)
-PHP_CONF_OPTS += --with-pdo-mysql
+PHP_CONF_OPTS += --enable-mysqlnd --with-pdo-mysql=mysqlnd
 endif
 ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_POSTGRESQL),y)
 PHP_CONF_OPTS += --with-pdo-pgsql=$(STAGING_DIR)/usr
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Quoted 12 lines · Thomas Petazzoni

Floris,

Could you have a look at the below patch?

Thanks!

Thomas

Quoted 3 lines · Ryan Coe

Without this configure option, mysqli was failing to build with my config after commit ea1e9e03442a5b375aa2214ba92e48ebba89070a. The build did not fail, however, I was unable to use mysqli in my application.

Did you downgrade PHP to an older version, or made any other changes? As I am unable to reproduce your issue.

- Cloned buildroot fresh from git.
- i386, static libs, only enabled PHP + mysqli

Let's see if PHP's info page know anything about mysqlnd at runtime:

$ output/target/usr/bin/php -i |grep mysqlnd
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 
241ae00989d1995ffcbbf63d579943635faf9972 $
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.12-dev - 20150407 - $Id: 
241ae00989d1995ffcbbf63d579943635faf9972 $
Loaded plugins => 
mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password
mysqlnd statistics =>

Appearently it does.
Let's try to connect to a server.

output/target/usr/bin/php <<"EOF"
<?php
$db = new mysqli("127.0.0.1", "root", "*mypassword*", ""); echo "Server version: {$db->server_info}\n";
EOF
Server version: 5.7.13-0ubuntu0.16.04.2

Doesn't seem to need a patch to me.

Yours sincerely,

Floris Bos

author
#3 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Floris, Thomas, All,

After applying my patch and rebuilding my system, I was still having trouble.
I tracked it down to needing to set mysqli.default_socket in my php.ini configuration.
This wasn't necessary before. I am going to revert my patch, rebuild, and test again.
This might have been a false alarm. I will report back my findings.

Quoted 54 lines · Floris Bos
Quoted 12 lines · Thomas Petazzoni

Floris,

Could you have a look at the below patch?

Thanks!

Thomas

Quoted 3 lines · Ryan Coe

Without this configure option, mysqli was failing to build with my config after commit ea1e9e03442a5b375aa2214ba92e48ebba89070a. The build did not fail, however, I was unable to use mysqli in my application.

Did you downgrade PHP to an older version, or made any other changes? As I am unable to reproduce your issue.

- Cloned buildroot fresh from git.
- i386, static libs, only enabled PHP + mysqli

Let's see if PHP's info page know anything about mysqlnd at runtime:

$ output/target/usr/bin/php -i |grep mysqlnd
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 
241ae00989d1995ffcbbf63d579943635faf9972 $
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.12-dev - 20150407 - $Id: 
241ae00989d1995ffcbbf63d579943635faf9972 $
Loaded plugins => 
mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password
mysqlnd statistics =>

Appearently it does.
Let's try to connect to a server.

output/target/usr/bin/php <<"EOF"
<?php
$db = new mysqli("127.0.0.1", "root", "*mypassword*", ""); echo "Server version: {$db->server_info}\n";
EOF
Server version: 5.7.13-0ubuntu0.16.04.2

Doesn't seem to need a patch to me.

Yours sincerely,

Floris Bos

#4 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Quoted 9 lines · Ryan Coe

Floris, Thomas, All,

After applying my patch and rebuilding my system, I was still having trouble.
I tracked it down to needing to set mysqli.default_socket in my php.ini configuration.
This wasn't necessary before. I am going to revert my patch, rebuild, and test again.
This might have been a false alarm. I will report back my findings.

Hmm, perhaps there needs to be an --with-mysql-sock option added to set the default socket path to the right location for the buildroot MySQL server.
I tend to use TCP instead for communication, so did not notice there may be something wrong with localhost through unix sockets.

BTW did notice the MySQL server version shipped by buildroot is old and EOL. If you are planning to use that, you might want to look at upgrading it.

Yours sincerely,

Floris Bos

author
#5 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Floris, Thomas, All,

I did build the system without my patch and was able to make everything work after defining the MySql socket location in my php.ini file. I guess my patch can be marked rejected. I was thrown off after looking at the build log. The statement "checking whether to enable mysqlnd... no" from the configure step led me to think that that mysqlnd was not getting built. If desired, I can submit a patch to add --with-mysql-sock.

On a side note, I am not using MySql version supplied by Buildroot. I have replaced MySql with MariaDB 10.0.

Quoted 27 lines · Floris Bos
Quoted 9 lines · Ryan Coe

Floris, Thomas, All,

After applying my patch and rebuilding my system, I was still having trouble.
I tracked it down to needing to set mysqli.default_socket in my php.ini configuration.
This wasn't necessary before. I am going to revert my patch, rebuild, and test again.
This might have been a false alarm. I will report back my findings.

Hmm, perhaps there needs to be an --with-mysql-sock option added to set the default socket path to the right location for the buildroot MySQL server.
I tend to use TCP instead for communication, so did not notice there may be something wrong with localhost through unix sockets.

BTW did notice the MySQL server version shipped by buildroot is old and EOL.
If you are planning to use that, you might want to look at upgrading it.

Yours sincerely,

Floris Bos

#6 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

Hello,

Quoted 6 lines · Ryan Coe

I did build the system without my patch and was able to make everything work after defining the MySql socket location in my php.ini file. I guess my patch can be marked rejected. I was thrown off after looking at the build log. The statement "checking whether to enable mysqlnd... no" from the configure step led me to think that that mysqlnd was not getting built. If desired, I can submit a patch to add --with-mysql-sock.

Yes, please. It would be good to have something that works out of the box.

Quoted 2 lines

On a side note, I am not using MySql version supplied by Buildroot. I have replaced MySql with MariaDB 10.0.

Patches adding MariaDB would be good too :)

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH 1/1 php: add --enable-mysqlnd to configure options when using mysql extensions

In reply to Ryan Coe
Quoted 9 lines · Ryan Coe

Floris, Thomas, All,

I did build the system without my patch and was able to make everything work after defining the MySql socket location in my php.ini file. I guess my patch can be marked rejected. I was thrown off after looking at the build log. The statement "checking whether to enable mysqlnd... no" from the configure step led me to think that that mysqlnd was not getting built. If desired, I can submit a patch to add --with-mysql-sock.

Have one here that expects the package providing MySQL to set a MYSQL_SOCKET variable, and the php package to use that:

http://lists.busybox.net/pipermail/buildroot/2016-September/171732.html
http://lists.busybox.net/pipermail/buildroot/2016-September/171733.html

Yours sincerely,

Floris Bos