diff mbox

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

Message ID 20160907154857.3147-1-bluemrp9@gmail.com
State Rejected
Headers show

Commit Message

Ryan Coe Sept. 7, 2016, 3:48 p.m. UTC
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.

Signed-off-by: Ryan Coe <bluemrp9@gmail.com>
---
 package/php/php.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni Sept. 7, 2016, 9:55 p.m. UTC | #1
Floris,

Could you have a look at the below patch?

Thanks!

Thomas

On Wed,  7 Sep 2016 08:48:57 -0700, Ryan Coe wrote:
> 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.
> 
> Signed-off-by: Ryan Coe <bluemrp9@gmail.com>
> ---
>  package/php/php.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/php/php.mk b/package/php/php.mk
> index deaf56e..766f3df 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -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
Floris Bos Sept. 7, 2016, 11:35 p.m. UTC | #2
On 09/07/2016 11:55 PM, Thomas Petazzoni wrote:
> Floris,
>
> Could you have a look at the below patch?
>
> Thanks!
>
> Thomas
>
> On Wed,  7 Sep 2016 08:48:57 -0700, Ryan Coe wrote:
>> 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
Ryan Coe Sept. 7, 2016, 11:36 p.m. UTC | #3
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.

On 09/07/2016 04:35 PM, Floris Bos wrote:
> On 09/07/2016 11:55 PM, Thomas Petazzoni wrote:
>> Floris,
>>
>> Could you have a look at the below patch?
>>
>> Thanks!
>>
>> Thomas
>>
>> On Wed,  7 Sep 2016 08:48:57 -0700, Ryan Coe wrote:
>>> 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
>
Floris Bos Sept. 8, 2016, 12:06 a.m. UTC | #4
On 09/08/2016 01:36 AM, Ryan Coe wrote:
> 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
Ryan Coe Sept. 8, 2016, 3:47 p.m. UTC | #5
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.

On 09/07/2016 05:06 PM, Floris Bos wrote:
> On 09/08/2016 01:36 AM, Ryan Coe wrote:
>> 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
>
Thomas Petazzoni Sept. 8, 2016, 3:52 p.m. UTC | #6
Hello,

On Thu, 8 Sep 2016 08:47:21 -0700, Ryan Coe wrote:

> 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.

> 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
Floris Bos Sept. 8, 2016, 4:03 p.m. UTC | #7
On 09/08/2016 05:47 PM, Ryan Coe wrote:
> 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
diff mbox

Patch

diff --git a/package/php/php.mk b/package/php/php.mk
index deaf56e..766f3df 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -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