Getting started with Shopify, PHP and Laravel and sqlserv

Topic summary

New Shopify custom app setup on Windows 10 with PHP 8.1, Laravel, Git, npm, Ngrok, and a MSSQL backend via the sqlsrv driver. The app, served locally (npm run dev) and accessed through Ngrok, failed with an Illuminate\Database\QueryException: “could not find driver” when Laravel queried the sessions table for a shop access_token.

Environment variables were correctly set for sqlsrv and the MSSQL instance (host, port, DB, user, password). The issue was the missing PDO driver: enabling php_pdo_sqlsrv_81_ts_x64.dll fixed it. After this change, Laravel could run migrations and create needed tables (including sessions), and the error disappeared.

Key terms: PDO (PHP Data Objects) is Laravel’s required database abstraction layer; sqlsrv alone isn’t sufficient. Ngrok exposes the local app to the web for Shopify OAuth and app loading.

Outcome: Database connectivity resolved. Open question: where to place custom PHP files within the Laravel project to begin app development (folder structure guidance still requested).

Summarized with AI on January 31. AI used: gpt-5.

Hi everyone,

New to Shopify, day 2 :joy: and need some help. I installed PHP 8.1, Laravel, Git, Npm and Ngrok (Windows 10 here) and created an app (custom app) from my free Shopify partner account. I am using the sqlserv database driver to connect to a MSSQL database that I have access to.

I run my app from localhost using npm run dev, and the service start up. When I load my app in a browser through ngrok (with my shop name and host parameters) I reach my app, which then gives me this error:

Illuminate\Database\QueryException
could not find driver (SQL: select top 1 1 [exists] from [sessions] where [shop] = MYAPPNAME.myshopify.com and [access_token] is not null)

There is then a big debug page with this:

I don’t know if the driver is the issue (PHP says it is loaded fine - php_sqlsrv_81_ts_x64.dll - I use the Windows PHP 8.1 thread safe version also). Also, I do not have the table “sessions”. I really just want to code my own custom app and SQL queries in PHP and run it via a Shopify interface.

Can anyone tell me where my "app " is in terms of its PHP code? It seems as if the app is picking up a default application and it seems to be trying to run it against a different data source.

My .env file has all the correct details (ip, username, password, ip address etc) for the database, redacted here:

APP_NAME=“myapp
APP_ENV=local
APP_KEY=base64:mylongkey
APP_DEBUG=true
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=sqlsrv
DB_HOST=1.2.3.4
DB_PORT=1433
DB_DATABASE=databasename
DB_USERNAME=sa
DB_PASSWORD=sapassword

I can connect to the database fine using SMSS with these details.

Any help appreciated :sleepy_face:

Found the issue, I needed the driver php_pdo_sqlsrv_81_ts_x64.dll. The clue was the “pdo” in one of the error messages. After changing that the tables were created and at least have no more errors :smiley:

Appreciate if someone could tell me where (folder-wise) I place my own PHP files to start work on my custom app?