Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#37452 closed enhancement (fixed)

php: add mysql variants to ${php}-mysql subports

Reported by: pcollinson Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: jyrkiwahlstedt
Port: php

Description

I'm running remi's releases on my Linux machines - and would like php5.4 and mysql5.5. Be good if you could supply a variant mysql55 for php54-mysql - I'd like apache2 to use mysql5.5 as default. Alternatively is there a better way of doing this?

Thanks.

Change History (11)

comment:1 Changed 8 years ago by ryandesign (Ryan Schmidt)

Milestone: MacPorts Future
Owner: changed from macports-tickets@… to ryandesign@…
Port: php added; php54-mysql removed
Summary: Port: php54-mysql needs mysql55 supportphp: add mysql variants to ${php}-mysql subports
Version: 2.1.2

Yes, I need to add variants to php-mysql for all of the mysql forks. mysql51, mysql55, mariadb, percona. I had been working on a patch for this, but I sort of put this project on hold when it became apparent that actually mariadb and percona need to become versioned ports as well; I was going to wait until after that had happened before resuming work on adding such variants (to php-mysql and other ports that need them).

Last edited 7 years ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:2 Changed 8 years ago by ryandesign (Ryan Schmidt)

However, note that you can and should use the +mysqlnd variant. It happily talks to whatever mysql-compatible server you're using.

comment:3 Changed 8 years ago by ryandesign (Ryan Schmidt)

Cc: jwa@… added

comment:4 in reply to:  2 Changed 8 years ago by pcollinson

Replying to ryandesign@…:

However, note that you can and should use the +mysqlnd variant. It happily talks to whatever mysql-compatible server you're using.

Thanks. I'll try that - as an aside I 'understood' perhaps incorrectly that this was intended to talk to 'the standard one that comes with MacOS' - and was looking for 5.5 support. Maybe the text needs to be a little more explicit? I'm trying to replace the somewhat intractable MAMP package with Macports for my test and development environment.

comment:5 Changed 8 years ago by ryandesign (Ryan Schmidt)

I'm open to adjusting the variant description. It currently reads "Use MySQL Native Driver", which is simply what the developers of PHP call it (http://php.net/mysqlnd).

comment:6 Changed 8 years ago by pcollinson

I've now got things working with mysqlsnd as you suggested. I have php54, mysql5.5 and mod_mysql_auth working. Thanks for your speedy and helpful response last night.

I don't think you have much space in Macports for comments about variants but:

I think that the variant perhaps should be labelled - 'Use any Mysql server on your system'. 'Native' in the Mac context means 'it's a Mac thing' to me.

Two key bits of ignorance led me to believe that things were not working - when they probably were:

'You may need to specify the socket address of the server in php.ini'. I've never had to do this before for a PHP installation probably because the dedicated people who make things work have always done it for me. The error message from mysqli_connect is less than helpful (Cannot find file or some such) and it takes a bit of time to realise that it cannot find the socket.

and

'Phpinfo will not tell you the version of your server, and will report a possibly a lesser version of mysql provided by the mysqlnd client library'. This fooled me into thinking that things were not working - when they were.

Thanks for all that you do BTW.

comment:7 in reply to:  6 Changed 8 years ago by ryandesign (Ryan Schmidt)

Replying to pc@…:

I think that the variant perhaps should be labelled - 'Use any Mysql server on your system'. 'Native' in the Mac context means 'it's a Mac thing' to me.

"MySQL Native Driver" is the name the PHP team have given to this feature. "Native" in this case means without the use of any external library.

Any of the variants can be used to connect to any MySQL or compatible server on your computer or any other computer, the only difference is what libraries they use to do so. The only consequence is that if for example you build php-mysql using +mysql51 but are connecting to a MySQL 5.5 server then possibly some new MySQL 5.5 features won't be available to you.

These variants are left over from a time (PHP 4) before mysqlnd existed—if you wanted to connect to a MySQL server, you had to build PHP with MySQL libraries, and since we had multiple versions of MySQL in MacPorts, we offered the user the choice; we didn't want to force the user to build MySQL 5 if they already had MySQL 4 installed, or vice versa. Now that mysqlnd exists and can communicate with any MySQL or compatible server without the need for any MySQL libraries, I'm seriously considering removing all the variants and making mysqlnd the only option.

Two key bits of ignorance led me to believe that things were not working - when they probably were:

'You may need to specify the socket address of the server in php.ini'. I've never had to do this before for a PHP installation probably because the dedicated people who make things work have always done it for me. The error message from mysqli_connect is less than helpful (Cannot find file or some such) and it takes a bit of time to realise that it cannot find the socket.

This is the one reason why I'm hesitant to remove the variants. If you use, say, the mysql55 variant, then PHP is automatically configured to use your local mysql55 server. This is not always what's wanted, and it can be overridden by editing the php.ini or specifying the server connection explicitly in your PHP code, but it's what's wanted often enough that it's quite helpful.

But with mysqlnd, we don't know what server you're using, so you need to edit the php.ini and tell it, or else specify the database connection parameters in PHP (which is probably what you should be doing all the time anyway).

and

'Phpinfo will not tell you the version of your server, and will report a possibly a lesser version of mysql provided by the mysqlnd client library'. This fooled me into thinking that things were not working - when they were.

Naturally. phpinfo() tells you the version of MySQL libraries used to compile the PHP mysql module. It was never meant to tell you anything about the version of MySQL running on your server.

comment:8 Changed 8 years ago by pcollinson

Thanks for this. It's all working for me now. It's providing a great test and development platform. The one problem I seem to have with the setup is that I have some legacy code that uses mysql() rather than mysqli(), this may be a show stopper for some people and perhaps should be a consideration if you remove all the other variants.

comment:9 in reply to:  8 Changed 8 years ago by ryandesign (Ryan Schmidt)

Replying to pc@…:

The one problem I seem to have with the setup is that I have some legacy code that uses mysql() rather than mysqli(), this may be a show stopper for some people and perhaps should be a consideration if you remove all the other variants.

As far as I can tell the old mysql extension, the new mysqli extension, and the even newer PDO MySQL should all work fine with mysqlnd or any of the MySQL client libraries. Are you saying you're having trouble using the old mysql extension together with mysqlnd? If so please elaborate.

comment:10 Changed 8 years ago by pcollinson

Doh. I needed to put the port into php.ini for mysql. Apologies.

comment:11 in reply to:  1 Changed 7 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: newclosed

Replying to ryandesign@…:

I need to add variants to php-mysql for all of the mysql forks. mysql51, mysql55, mariadb, percona.

r106507

Note: See TracTickets for help on using tickets.