cloudfoundry / php-buildpack

A Cloud Foundry Buildpack for PHP.
Apache License 2.0
142 stars 346 forks source link

Add mssql/sybase support through freetds & dblib in php5/6 #157

Closed wbean1 closed 8 years ago

wbean1 commented 8 years ago

Feel free to close if this is an outlandishly complex request... it very well might be.

RHEL7 & Ubuntu 14.4 both supply convenience packages for using mssql through freetds.

Ubuntu has php5-sybase which installs:

# dpkg -L libsybdb5
...
/usr/lib/x86_64-linux-gnu/libsybdb.so.5.0.0
/usr/lib/x86_64-linux-gnu/libsybdb.so.5

# dpkg -L php5-sybase
...
/usr/lib/php5/20121212/pdo_dblib.so
/usr/lib/php5/20121212/mssql.so
...
/usr/share/php5/sybase/pdo_dblib.ini
/usr/share/php5/sybase/mssql.ini

RHEL has php-mssql which installs:

# rpm -ql freetds-0.95.81-1.el7.x86_64
....
/usr/lib64/libsybdb.so.5
/usr/lib64/libsybdb.so.5.1.0

# rpm -ql php-mssql-5.4.16-4.el7.x86_64
/etc/php.d/mssql.ini
/etc/php.d/pdo_dblib.ini
/usr/lib64/php/modules/mssql.so
/usr/lib64/php/modules/pdo_dblib.so

It'd be super fantastic if similar support could be added to the php-buildpack. Alternatively, any guidance on how one might fork the https://github.com/cloudfoundry/binary-builder project, adjust the recipes in there, and create these additional binaries would be appreciated...

I understand that mssql support was removed in PHP7, and that microsoft is working on this thing as the future... https://github.com/Azure/msphpsql. That thing, however, does not look any easier to integrate into a buildpack fork than freetds, unfortunately.

cf-gitbot commented 8 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/128861119

The labels on this github issue will be updated when the story is started.

RochesterinNYC commented 8 years ago

@wbean1 What you're proposing, as we understand it, sounds very similar to what @dmikusa-pivotal did in a recent PR to binary-builder to add optional oracle support to built PHP binaries: https://github.com/cloudfoundry/binary-builder/pull/13

Would you be open to submitting a pull request in a similar vein if that kind of binary-builder support is what you're looking for?

dmikusa commented 8 years ago

For what it's worth, I think this would actually be easier than the Oracle PR. This one doesn't depend on proprietary libraries, it uses FreeTDS which is LGPL software, so it should be easier to package up and no conditional logic.

Off the top of my head, I think you'd just need to...

1.) Edit the ./configure options for PHP to enable the mssql extension here and here.

2.) Have it install the FreeTDS packages here and here.

3.) Have it copy the required FreeTDS shared libraries here and here.

Not sure if that's exactly everything, but it should give you a place to start if you're willing to work on a PR.

wbean1 commented 8 years ago

Thanks for the guidance. Just hearing that its not an absurd request that'd be shot down is encouraging. I'll try to get a PR together in the next week or so.

jchesterpivotal commented 8 years ago

In the meantime, do you object to us closing this issue?

wbean1 commented 8 years ago

nope, that's fine