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

[Docs]: sqlsrv with new arm64 (Apple M1/M2) #1006

Open
Stylix opened this issue Oct 13, 2023 · 0 comments
Open

[Docs]: sqlsrv with new arm64 (Apple M1/M2) #1006

Stylix opened this issue Oct 13, 2023 · 0 comments
Assignees

Comments

@Stylix
Copy link

Stylix commented Oct 13, 2023

What is wrong in the documentation?

No response

What is missing in the documentation?

Hello @cytopia ,

After updating my docker and my devilbox, I launched my new containers with PHP8.1 and put the script for the mssql obc driver put I've got an error when trying to connect to my database :

Unsupported processor architecture

After looking some issues on google, I find that the default script use debian 9 version and the amd64.deb version of msodbcsql.

With some updates on the script, it's now working !

Before launch this script, you have to check the debian version of your container (if you use debian, not alpine of course).

cat /etc/os-release

Example of my return :

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

And second point, check the version of which version of the driver you want (for me le last one for now).

Here the compete script :

#!/bin/bash
#
# This script will automatically install the Microsoft ODBC driver for MsSQL
# support for PHP during startup.
#
# In order for it to work, you must read and accept their License/EULA:
# https://odbceula.blob.core.windows.net/eula17/LICENSE172.TXT
#


# ------------------------------------------------------------------------------------------------
# EDIT THE VARIABLE BELOW TO ACCEPT THE EULA (If you agree to their terms)
# ------------------------------------------------------------------------------------------------

###
### Set this to "Y" (capital 'Y') if you accept the EULA.
###
ACCEPT_EULA=Y



# ------------------------------------------------------------------------------------------------
# DO NOT EDIT BELOW THIS LINE
# ------------------------------------------------------------------------------------------------

###
### Where to retrieve the deb package
###
MSODBC_URL="https://packages.microsoft.com/debian/11/prod/pool/main/m/msodbcsql18/"


###
### Pre-flight check
###
if [ "${#}" = "1" ]; then
	if [ "${1}" = "ACCEPT_EULA=1" ]; then
		ACCEPT_EULA=Y
	fi
fi
if [ "${ACCEPT_EULA}" != "Y" ]; then
	echo "MS ODBC EULA not accepted. Aborting installation."
	exit 0
fi


###
### EULA accepted, so we can proceed
###

# Extract latest *.deb packate
MSODBC_DEB="$( curl -k -sS "${MSODBC_URL}" | grep -Eo 'msodbcsql[-._0-9]+?_arm64\.deb' | tail -1 )"

# Download to temporary location
curl -k -sS "${MSODBC_URL}${MSODBC_DEB}" > "/tmp/${MSODBC_DEB}"

# Install
ACCEPT_EULA="${ACCEPT_EULA}" dpkg -i "/tmp/${MSODBC_DEB}"

# Remove artifacts
rm -f "/tmp/${MSODBC_DEB}"

If that can help someone ;)

Are you willing to provide a PR to address this?

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants