Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to build the php-sqlsrv extension for the linux/arm64 platform #159

Closed
stronk7 opened this issue Jan 28, 2023 · 3 comments
Closed

Try to build the php-sqlsrv extension for the linux/arm64 platform #159

stronk7 opened this issue Jan 28, 2023 · 3 comments

Comments

@stronk7
Copy link
Member

stronk7 commented Jan 28, 2023

It seems that, since June 2022 (version 5.10), there is support for arm64 in the php sqlsrv drivers/extension.

https://learn.microsoft.com/en-us/sql/connect/php/release-notes-php-sql-driver?view=sql-server-ver16

Let's give to it a try and check if now we can build it for our arm64 images.

@stronk7 stronk7 changed the title Try to build the php-sqlsrv extension for the inux/arm64 platform Try to build the php-sqlsrv extension for the linux/arm64 platform Jan 28, 2023
@scara
Copy link
Contributor

scara commented Jan 29, 2023

Hi @stronk7,
do you mean something like below for 8.1 (7.4? 8.0?) up to 8.2? I can create the related PRs.

diff --git a/root/tmp/setup/php-extensions.sh b/root/tmp/setup/php-extensions.sh
index cf56e5d..e61d194 100755
--- a/root/tmp/setup/php-extensions.sh
+++ b/root/tmp/setup/php-extensions.sh
@@ -77,11 +77,14 @@ echo "pcov.initial.files=1024" >> /usr/local/etc/php/conf.d/docker-php-ext-pcov.
 # Install Microsoft dependencies for sqlsrv.
 # (kept apart for clarity, still need to be run here
 # before some build packages are deleted)
-if [[ ${TARGETPLATFORM} == "linux/amd64" ]]; then
-    /tmp/setup/sqlsrv-extension.sh
-else
-    echo "sqlsrv extension not available for ${TARGETPLATFORM} architecture, skipping"
-fi
+case $TARGETPLATFORM in
+    linux/amd64|linux/arm64)
+        /tmp/setup/sqlsrv-extension.sh
+        ;;
+    *)
+        echo "sqlsrv extension not available for ${TARGETPLATFORM} architecture, skipping"
+        ;;
+esac

 # Keep our image size down..
 pecl clear-cache
diff --git a/root/tmp/setup/sqlsrv-extension.sh b/root/tmp/setup/sqlsrv-extension.sh
index 4911851..b834cf1 100755
--- a/root/tmp/setup/sqlsrv-extension.sh
+++ b/root/tmp/setup/sqlsrv-extension.sh
@@ -5,14 +5,13 @@ set -e
 # Install Microsoft dependencies for sqlsrv
 echo "Downloading sqlsrv files"
 curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
-# TODO, bullseye should be 11, but the msodbcsql17 package is not available yet, hence using buster (10) one.
-curl https://packages.microsoft.com/config/debian/10/prod.list -o /etc/apt/sources.list.d/mssql-release.list
-apt-get update
+curl https://packages.microsoft.com/config/debian/11/prod.list -o /etc/apt/sources.list.d/mssql-release.list
+apt update

 echo "Install msodbcsql"
-ACCEPT_EULA=Y apt-get install -y msodbcsql17
+ACCEPT_EULA=Y apt install -y msodbcsql18 mssql-tools18

-ln -fsv /opt/mssql-tools/bin/* /usr/bin
+ln -fsv /opt/mssql-tools18/bin/* /usr/bin

 # Need 5.10.1 (or later) for PHP 8.2 support
 pecl install sqlsrv-5.10.1

HTH,
Matteo

@andrewnicols
Copy link
Contributor

Hopefully solved in #164.

Supported for PHP 8.0 onwards it seems, but not earlier.
https://learn.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-ver16

@stronk7
Copy link
Member Author

stronk7 commented Mar 16, 2023

Closed by #164

@stronk7 stronk7 closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants