-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add ext-sqlsrv support #417
Comments
There are two reasons why this hasn't happened yet:
|
Yep. In the mean time I have managed to get this (and ext-pdo_sqlsrv) running by hosting the pre-built .so files for ubuntu from microsoft with a packages.json like you described in the build docs. And I use heroku-buildpack-apt with msodbcsql17 and unixodbc-dev :-) |
Hello @boboldehampsink , can you publish steps how to make ext-pdo_sqlsrv work? I'm still a newbie with Heroku. |
I did ^^ |
Ok, thank u. |
Hello @boboldehampsink , I apologize for the duplicate question here. I've wired up and hosted a custom But the instance isn't loading the odbc libraries from where they reside (eg. I realize this isn't a support forum, but any information or direction you can provide would be greatly appreciated! |
HI @benpbolton, here's what I did to make it work:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/app/.apt/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.6.so.1.1
UsageCount=1
P.S. I use PHP 7.3, I couldn't get ext-sqlsrv to work with 7.4. There is a new version coming up (5.9.0) that works with PHP 8 and might work with 7.4, but it is still in beta. https://github.com/microsoft/msphpsql/releases |
🤦♂️ I had neglected Heroku Stack and Buildpack
To enable SQL Server via php, we are using multiple buildpacks, custom Buildpack
AptfileThe above buildpack allows us to customize additional packages for installation prior to dyno run. The Note that the environmental variable
Composer and Heroku Custom BuildpacksHeroku's php buildpack documentation is extensive. Here's what you need to know:
... and your
ODBCMicrosoft's SQL Server uses ODBC for the majority of lifting here. The default buildpack instructs ODBC to attempt drivers at a default location of The
|
Version 5.9.0 is out and I still couldn't get it to work with anything other than PHP 7.3 on Heroku (works locally). I think this might be a bug in the buildpack @dzuelke? Here's what happens:
Looks like after bootstrapping it tries to use the 7.3 version for 8.0? |
@dzuelke now with the PHP bootstrapping version being bumped to 7.4, my app fails to build. I might be wrong but I think the bootstrapping PHP version should ignore the ext requirements, only the chosen php version should check/install them? would solve the problem above as well ^^ |
It does ignore the ext requirements. The problem must be somewhere else. It looks like your custom builds do not have the right version requirements in place for each package. Without seeing your build code, repository metadata, error logs etc, I can't help you. |
@dzuelke what do you need, an app name? or a repo? |
Your code that builds the extensions and the repository, and the resulting repository URL, @boboldehampsink |
@dzuelke what do you mean with repository in this context? By the way, if it helps: if I don't supply a 7.4 version of my ext, the heroku build already fails in the bootstrapping phase. That's why I guessed it is used in bootstrapping, while it shouldn't. Supplying a 7.4 version passes bootstrapping, then fails if the selected php version != 7.4 |
Yeah so it installs the wrong version (built for another PHP series); probably because your custom package Composer repository say this (copied verbatim from your comment further above):
That needs to be a) That's why I said I need to look at your repository for your custom extension build - that |
@dzuelke I do use 7.4.* - here is my packages file: https://raw.githubusercontent.com/robuust/heroku-php/php8-pdo_sqlsrv/packages.json Here's the build log for that:
|
Right, so. First problem:
Second, you need " You might also want (That's why the buildpack itself has separate repositories per stack, but you could just as well all dump them into the same repo, as long as you ensure the ordering of packages is correct). |
Thanks checking @dzuelke. I have fixed the issue with the tar. About me using I also added the platform requirement. Everything now works! |
I think this issue makes a great example on "hosting a proprietay extension using custom tooling", and may now be closed? |
Hi @boboldehampsink . |
Platform packages must require others with their "`heroku-sys`" prefix; thanks for bringing this up in #417 (comment), @boboldehampsink
https://raw.githubusercontent.com/robuust/heroku-php/pdo_sqlsrv/packages.json |
@boboldehampsink: I just went through this entire ordeal to build the igbinary and phpredis extension. I'd be happy to add sqlsrv to the platform repo here: https://github.com/cachewerk/heroku-php-extensions |
Go ahead! |
It is worth noting that with all of the above, when using Symfony/Doctrine (I'm currently on Symfony 5.2), the doctrine > dbal > connection configuration MUST include the
|
I highly appreciate this conversation as it guides me through the problem, especially of @boboldehampsink and @benpbolton . I could see the driver setup successfully as
and
I did also find the However I'm facing another problem as the log now returns:
Since I could not find any related sources in Update Here are what I've tried to upgrade OpenSSL (in case another person face the same problem):
Now everything works! Nice! |
@benpbolton I was able to solve the deployment in automatic, using a few various parts and it starts perfectly in each deploy First I use the build pack https://github.com/heroku/heroku-buildpack-apt to install obc and mssql toolsaptfile contains this and the heroku env var of Aptfile section of @benpbolton guide
After that, I add the build pack https://github.com/niteoweb/heroku-buildpack-shell.git to execute a bash during the deploy process Step 1: Create a .heroku folder
Example:
I'm not a bash script master so I put in raw the names of the files if u are a bash master please improve this file and share it build packs order deploy results
|
Platform packages must require others with their "`heroku-sys`" prefix; thanks for bringing this up in heroku/heroku-buildpack-php#417 (comment), @boboldehampsink
Hi,
It's been a while since #175 and a lot has changed since then. Microsoft has shipped
ext-sqlsrv
and it is available for ubuntu and it is stable: https://github.com/microsoft/msphpsql.Since Heroku also offers MSSQL/SQL Server add-ons, I like to be able to use them with PHP.
The text was updated successfully, but these errors were encountered: