Open zippy1981 opened 7 years ago
AFAIK, the ODBC driver from Microsoft is not compatible with Alpine because of musl's libc.
@zippy1981 We can get the PHP Driver to compile on Alpine Linux but the ODBC Driver as @mimetnet mentioned, is not compatible with Alpine. We do have a docker image that you can use for now: https://hub.docker.com/r/lbosqmsft/php-mssql/. We are looking into supporting additional distros (alpine, debian etc.) We will keep you posted.
Not sure, but may be this can help with libc: https://github.com/docker/compose/blob/master/Dockerfile.run
Can it work with http://www.unixodbc.org/? Alpine already has in repositories
Any progress on that?
Any updates?
@ruudboon No updates. Alpine still is not a supported Linux distribution for the ODBC Driver. We will keep Alpine in mind as we evaluate supporting additional distributions.
Regards, David
This is becoming a dealbreaker for me, especially as I attempt to put more of my apps into docker, using alpine, which is more-or-less best practice for most situations.
Is there any way, even with some hacks, to get this working in alpine?
perhaps this image is suitable for installing msphpsql https://github.com/frol/docker-alpine-glibc
It would be awesome to see support for Alpine
Dear Microsoft, please note that everybody is creating containers on Alpine distro's, could you please help my DevOps life?
Br
It would be awesome to see support for Alpine Linux 👍
update..?
It's in our backlog, but as @David-Engel said above:
No updates. Alpine still is not a supported Linux distribution for the ODBC Driver. We will keep Alpine in mind as we evaluate supporting additional distributions.
Is there any progress?
There will "never" be. Thats why the open source community struggles so much against Java and other technologies. Very academic interests point of view, only. We simply gave up using Alpine and moved on.
Em qui, 8 de nov de 2018 às 05:30, herojhc notifications@github.com escreveu:
Is there any progress?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Microsoft/msphpsql/issues/300#issuecomment-436899033, or mute the thread https://github.com/notifications/unsubscribe-auth/ALM6U3zWybsBZiW9qScI8dHpuowcYroJks5us92sgaJpZM4MJ48f .
--
Andre Luiz / IT and Trading alsillva86@gmail.com / +55 11 984129269
[image: Linkedin] http://br.linkedin.com/in/bahuan[image: skype] http://alosilva86
Thats why the open source community struggles so much against Java and other technologies
Isn't it the other way around? The open source community doesn't struggle. Microsoft struggles to support new technology like docker / alpine.
We simply gave up using Alpine and moved on.
That's easy for you to say, but alpine provides a benefit to many users, and many containers and environments are build on it. It's far from "academic." It's "I have hundreds of alpine containers, and if this driver doesn't work on alpine, I can't use it."
By not supporting alpine, they're not supporting a place where their users want to run their software.
Microsoft struggles to support new technology like docker / alpine.
Microsoft fully supports Docker containers and is very much on board with that model. Alpine is just one Linux distribution that happens to be optimized for the container model.
Supporting another platform is not just adding some code and some tests to your existing code base and CI. It also means ensuring all your dependencies are on the new platform, creating new packaging and new test (and probably build) infrastructure that has to be maintained going forward. That all costs money and money is not infinite so people have to prioritize. Alpine has a lot going for it and it is getting a lot of traction in the container world. That has not gone unnoticed.
looking for msodbcsql17 for alpine too maybe it's time to move to centos ......
One more 👍 thumbsup vote for Microsoft ODBC support for alpine
Currently test script doesn't work.
php -i | grep sqlsrv
/etc/php7/conf.d/30-sqlsrv.ini,
/etc/php7/conf.d/35-pdo_sqlsrv.ini,
Registered PHP Streams => compress.zlib, https, ftps, php, file, glob, data, http, ftp, zip, phar, sqlsrv
PDO drivers => dblib, sqlsrv
pdo_sqlsrv
pdo_sqlsrv support => enabled
pdo_sqlsrv.client_buffer_max_kb_size => 10240 => 10240
pdo_sqlsrv.log_severity => 0 => 0
sqlsrv
sqlsrv support => enabled
<?php
$conn_array = array (
"UID" => "sa",
"PWD" => "secretpassword",
"Database" => "testdatabase",
);
$conn = sqlsrv_connect("192.168.1.3, 5555", $conn_array);
if ($conn){
echo "connected";
if(($result = sqlsrv_query($conn,"SELECT * FROM dbo.table")) !== false){
while( $obj = sqlsrv_fetch_object( $result )) {
echo $obj->colName.'<br />';
}
}
}else{
die(print_r(sqlsrv_errors(), true));
}
Array
(
[0] => Array
(
[0] => IMSSP
[SQLSTATE] => IMSSP
[1] => -49
[code] => -49
[2] => This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712
[message] => This extension requires the Microsoft ODBC Driver for SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712
)
)
Tried to make frankenstein with FROM frolvlad/alpine-glibc alpine with glibc hackish way
bash-4.4# apk add nano
(1/2) Installing libmagic (5.36-r0)
(2/2) Installing nano (3.2-r0)
Executing busybox-1.29.3-r10.trigger
Executing glibc-bin-2.29-r0.trigger
/usr/glibc-compat/sbin/ldconfig: /usr/lib/libsodium.so.23 is not a symbolic link
OK: 78 MiB in 92 packages
bash-4.4# ldd /usr/lib/libsodium.so.23
ldd (0x7f60dfa83000)
libc.musl-x86_64.so.1 => ldd (0x7f60dfa83000)
alpine glibc version doesn't have docker-php-ext-install
+ docker-php-ext-install pdo_dblib
/bin/sh: docker-php-ext-install: not found
So fallbacked to pecl install with apk add g++ make
I would also like for this to happen, does anyone know the team internally at Microsoft? I would like to try and work with them.
Please, DM me if you have any contacts at Microsoft that can help with this situation or if you know the team working on it.
@ZaxLofful Most of the top contributors here are working for Microsoft. I'm the PM for drivers for SQL Server. Alpine support is on the roadmap for the ODBC and PHP drivers. It's just a matter of getting it prioritized and funded. See my previous comment for details. Upvoting this issue provides the best user feedback to the right people for getting Alpine support prioritized.
@David-Engel
It's just a matter of getting it prioritized and funded.
It would be so nice to use alpine based containers connecting to mssql containers, and mssql is a good product right? The funds shouldn't be a problem (my opinion) cause the entry level for using mssql would be lower when the drivers are easily integrated. I mean there are so much use-cases to prefer mssql above other sql solutions.
I agree with you, this is the kind of issue that makes the relevance/demand to be a priority.
On Wed, Jul 17, 2019, 12:43 David Engel notifications@github.com wrote:
@ZaxLofful https://github.com/ZaxLofful Most of the top contributors here are working for Microsoft. I'm the PM for drivers for SQL Server. Alpine support is on the roadmap for the ODBC and PHP drivers. It's just a matter of getting it prioritized and funded. See my previous comment https://github.com/microsoft/msphpsql/issues/300#issuecomment-439560083 for details. Upvoting this issue provides the best user feedback to the right people for getting Alpine support prioritized.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/msphpsql/issues/300?email_source=notifications&email_token=ACZTUU45FEU2P2N25S3N5M3P7443BA5CNFSM4DBHR4P2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2E2J3Y#issuecomment-512337135, or mute the thread https://github.com/notifications/unsubscribe-auth/ACZTUUYEHF4BSLE4W63U7FLP7443BANCNFSM4DBHR4PQ .
We've been using Pymssql, but are now being forced to switch to pyodbc due to the issue above. We're running Alpine on our containers, so we're hopeful that an Alpine-compatible driver can be released soon.
@devrsw as mentioned above,
Alpine support is on the roadmap for the ODBC and PHP drivers.
Please stay tuned.
@yitam That would be so cool. However, trying to keep realistic expectations....we have been waiting for such things as (official) AD authentication (in the case of mssql for linux), and been told "weeks to months", which have turned into years.... :)
Ray of light: Alpine support in the MS ODBC Driver for SQL Server is being worked on right now and should be done for the next MS ODBC driver release. The PHP drivers are also planned to be released with Alpine support about the same time (obviously ODBC dependent).
Ray of light: Alpine support in the MS ODBC Driver for SQL Server is being worked on right now and should be done for the next MS ODBC driver release. The PHP drivers are also planned to be released with Alpine support about the same time (obviously ODBC dependent).
Thank you. Can you please provide a rough next MS ODBC driver release date?
Thank you. Can you please provide a rough next MS ODBC driver release date?
End of January, beginning of February.
Far from being ready. The pecl compilation for the php extensions fails with:
/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: sql.h: No such file or directory
Plus, there are errors on the MS instructions page. curls missing the -O option, and also the file names for verification being wrong (not matched what was downloaded).
Thanks for the update. We will double check the documentation.
For pecl compilation to work, please install unixodbc-dev
first.
This is what I did on an alpine-based Dockerfile to install it:
RUN wget https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.1.1-1_amd64.apk && \
wget https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.5.1.1-1_amd64.apk && \
apk add --allow-untrusted msodbcsql17_17.5.1.1-1_amd64.apk && \
apk add --allow-untrusted mssql-tools_17.5.1.1-1_amd64.apk && \
apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS unixodbc-dev && \
pecl install pdo_sqlsrv && \
docker-php-ext-enable pdo_sqlsrv && \
apk del .phpize-deps && \
rm msodbcsql17_17.5.1.1-1_amd64.apk && \
rm mssql-tools_17.5.1.1-1_amd64.apk
I'm about to test if it works, but it compiled with no errors.
Thanks for the update @acelaya
Just so you know, for 5.8.0 the support for Alpine is experimental. In particular, we do not currently recommend enabling both drivers because there are some known issues. If you do encounter new issues when using either sqlsrv or pdo_sqlsrv, please create a new issue for us to keep track.
Thanks for the tip @yitam. I have just left pdo_sqlsrv
and removed the other one.
Then I have done some tests and it seems to partially work, but I also get this error: locale::facet::_S_create_c_locale name not valid
.
By searching a bit you can find that's because of missing locale configuration. However, while it is easy to solve on other distros, it's not as easy to workaround on alpine.
I will continue investigating.
Thanks @acelaya
We also encountered that in our testing, and for now, it seems export LC_ALL=C
is a workaround. We are investigating on our side as well.
Yeah!! That did the trick :smiley:
Everything is working on my set-up now.
Just so you know, for 5.8.0 the support for Alpine is experimental. In particular, we do not currently recommend enabling both drivers because there are some known issues. If you do encounter new issues when using either sqlsrv or pdo_sqlsrv, please create a new issue for us to keep track.
I just want to reiterate @yitam's comment. Alpine has some peculiar differences compared to other distributions. Given our testing and the issues we noted in the release notes, we were not confident calling this PHP release production-ready for Alpine. Our thought is to let it get run through some paces by others and identify any issues, so please file them in this repo if you encounter them. If we need to, we can release an update to address any critical issues.
So for me using @acelaya 's instructions (modified) I was able to install everything, including both pecl extensions. However, upon testing, I am getting:
Fatal error: sqlsrv_connect: Unknown exception caught. in /app/core.php on line 12 (place where I am calling the connection)
With this happening at the $conn = sqlsrv_connect( $host, $connectionOptions);
point. So I am not really able to get much info out of this.
@bkraul This is a known issue. If possible, you can work around it by setting CharacterSet
to UTF-8
in the connection options.
@david-puglielli Thanks. That did work. I am assuming at some point specifying this will not be needed? And are there any known complications with the use of UTF-8 for connections where it hasn't been used before?
@bkraul , as I mentioned to @acelaya export LC_ALL=C
is another workaround for the time being.
@yitam I'm trying to figure out where I am supposed to place the export LC_ALL=C
. I am putting it in the RUN
section of my Dockerfile, but it does not seem to affect anything. The script still errors unless I include the CharacterSet
option. This is what I have:
RUN set -x \
# install the build pre-requisites.
&& apk add --no-cache --virtual .build-deps autoconf file g++ make pkgconf re2c php7-dev unixodbc-dev libmcrypt-dev \
# install mssql drivers
&& curl https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.1.1-1_amd64.apk -O \
&& curl https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.5.1.1-1_amd64.apk -O \
&& apk add --allow-untrusted msodbcsql17_17.5.1.1-1_amd64.apk \
&& apk add --allow-untrusted mssql-tools_17.5.1.1-1_amd64.apk \
# at the mssql-tools binary to the path.
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile \
&& echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc \
&& /bin/bash -c "source ~/.bashrc" \
# install the pecl extensions.
&& pecl install mcrypt-1.0.2 \
&& pecl install pdo_sqlsrv \
&& pecl install sqlsrv \
&& pecl install igbinary \
&& pecl install msgpack \
# enable the extensions.
&& echo extension=mcrypt.so > /etc/php7/conf.d/20-mcrypt.ini \
&& echo extension=pdo_sqlsrv.so > /etc/php7/conf.d/30-pdo_sqlsrv.ini \
&& echo extension=sqlsrv.so > /etc/php7/conf.d/20-sqlsrv.ini \
&& echo extension=igbinary.so > /etc/php7/conf.d/20-igbinary.ini \
&& echo extension=msgpack.so > /etc/php7/conf.d/20-msgpack.ini \
# locale workaround.
&& export LC_ALL=C \
# perform image cleanup.
&& apk del .build-deps \
&& rm msodbcsql17_17.5.1.1-1_amd64.apk \
&& rm mssql-tools_17.5.1.1-1_amd64.apk \
&& docker-run-bootstrap \
&& docker-image-cleanup
@bkraul when we were testing adding ENV LC_ALL=C
to the Dockerfile seemed to work. Can you try that?
@yitam That seems to do the trick. Thank you for your quick replies. Very excited at the prospect of this going on prod soon. It slashes my image size by 2/3!!
its there guys :)
Just a little detail: the pt-br version of documentation does not contain the Alpine Linux
section. It would be good add there also.
Just a little detail: the pt-br version of documentation does not contain the
Alpine Linux
section. It would be good add there also.
Translation of the online docs is automated and out of our control. It's probably just taking a while or something is stuck in whatever translation pipeline the doc team uses. I assume it will get there eventually.
Hi all, please note that 5.8.1 hotfix is released! The workarounds mentioned above are no longer required. Please try it out and let us know if you run into any issues.
Alpine linux uses a smaller libc than ubuntu and redhat and produces really small docker images. There are official php docker images on docker hub that use this. One installs an extension on them via the command
docker-php-ext-install
this compiles the extension from source and setups up an INI file for it.I have not determined if any of the following tasks are already done:
docker-php-ext-install
will pull the driver.