GitHub Readme.md
The code samples are available here
Aptfile file is mandatory, create a file called Aptfile in your project root folder and
to your project root folder.
It must be set,
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://github.com/heroku-softtrends/mssql-server-drivers-for-php/raw/main/5.11.1/ubuntu/22.04/php/8.1/nts/packages.json" -a <heroku_app_name>
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://github.com/heroku-softtrends/mssql-server-drivers-for-php/raw/main/5.11.1/ubuntu/22.04/php/8.2/nts/packages.json" -a <heroku_app_name>
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://github.com/heroku-softtrends/mssql-server-drivers-for-php/raw/main/5.10.0/ubuntu/20.04/php/8.1/nts/packages.json" -a <heroku_app_name>
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://github.com/heroku-softtrends/mssql-server-drivers-for-php/raw/main/5.10.0/ubuntu/20.04/php/8.0/nts/packages.json" -a <heroku_app_name>
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://github.com/heroku-softtrends/mssql-server-drivers-for-php/raw/main/5.10.0/ubuntu/20.04/php/7.4/nts/packages.json" -a <heroku_app_name>
Add required dependencies(SQLSRV and PDO_SQLSRV drivers) to composer.json file
{
"require": {
"php": "~8.1.0",
"ext-sqlsrv": "^5.11",
"ext-pdo_sqlsrv": "^5.11"
}
}
{
"require": {
"php": "~8.2.0",
"ext-sqlsrv": "^5.11",
"ext-pdo_sqlsrv": "^5.11"
}
}
{
"require": {
"php": "~8.1.0",
"ext-sqlsrv": "^5.10",
"ext-pdo_sqlsrv": "^5.10"
}
}
{
"require": {
"php": "~8.0.0",
"ext-sqlsrv": "^5.10",
"ext-pdo_sqlsrv": "^5.10"
}
}
{
"require": {
"php": "~7.4.0",
"ext-sqlsrv": "^5.10",
"ext-pdo_sqlsrv": "^5.10"
}
}
After adding new dependencies to composer.json file, must be updated by running:
$ composer update --ignore-platform-reqs
Finally the composer.lock
file will look like,
{
"platform": {
"php": "~8.1.0",
"ext-pdo_sqlsrv": "^5.11",
"ext-sqlsrv": "^5.11"
}
}
{
"platform": {
"php": "~8.2.0",
"ext-sqlsrv": "^5.11",
"ext-pdo_sqlsrv": "^5.11"
}
}
{
"platform": {
"php": "~8.1.0",
"ext-pdo_sqlsrv": "^5.10",
"ext-sqlsrv": "^5.10"
}
}
{
"platform": {
"php": "~8.0.0",
"ext-sqlsrv": "^5.10",
"ext-pdo_sqlsrv": "^5.9"
}
}
{
"platform": {
"php": "~7.4.0",
"ext-sqlsrv": "^5.10",
"ext-pdo_sqlsrv": "^5.10"
}
}
https://github.com/heroku/heroku-buildpack-apt.git
https://github.com/heroku/heroku-buildpack-php.git
https://github.com/heroku-softtrends/heroku-php-sqlsrv-buildpack.git
$ git init
$ heroku git:remote -a <app_name>
$ git add --all
$ git commit -m "First commit"
$ git push heroku master
$ heroku open -a <heroku_app_name>
Copy the snippet above into CLI.