Generic SQL API Framework is a PHP backend and can be hosted using a normal PHP environment.
For Windows, the repository includes a prebuilt PHP runtime, so users do not need to install PHP manually when using the bundled runtime.
The current bundled runtime is Windows-specific.
Linux runtime packaging is planned separately.
The repository includes:
runtime/
└── windows/
└── php/
├── php.exe
├── php.ini
└── ext/
The runtime contains the PHP installation required by the API, including the PHP ODBC extension.
This means a Windows user does not need:
- A separate PHP installation
- XAMPP
- WAMP
- A manually configured PHP environment
when using the bundled runtime.
From the project root:
start-windows.batThe startup script performs the required checks and starts the API automatically.
The startup script checks the environment in this order:
Start
|
v
PHP Runtime
|
v
php.ini
|
v
Runtime Directories
|
v
PHP ODBC
|
v
Database Configuration
|
v
Database Connection
|
v
API Directory
|
v
Available Port
|
v
Start PHP Server
If one of the required checks fails, the API startup is stopped.
The Windows launcher creates required directories automatically.
runtime/windows/php/opcache/
logs/
You do not need to create these directories manually.
The startup script creates them when they do not exist.
The bundled PHP configuration is:
runtime/windows/php/php.ini
The launcher explicitly loads this configuration.
You can verify it with:
runtime\windows\php\php.exe --iniExpected:
Loaded Configuration File:
D:\...\runtime\windows\php\php.ini
The exact path depends on where the project is installed.
The Windows runtime includes the PHP ODBC extension.
Check it with:
runtime\windows\php\php.exe -m | findstr /i odbcExpected:
odbc
PHP ODBC provides the connection between PHP and the installed SQL Server ODBC driver.
PHP
|
v
PHP ODBC Extension
|
v
SQL Server ODBC Driver
|
v
SQL Server
Before starting the API, configure:
database/config/database.json
The Windows launcher checks the database connection before starting the API.
If the connection fails, the API does not start.
The startup script runs the database check before starting the PHP server.
Successful flow:
Checking database connection...
[OK] Database Connected
Failed flow:
Checking database connection...
[FAILED] Database connection failed.
Please configure:
database/config/database.json
This prevents the API from starting when the backend cannot reach its configured database.
The default starting port is:
8000
If port 8000 is already being used, the launcher automatically checks the next port.
The current range is:
8000 - 8100
Example:
Port 8000 -> In use
Port 8001 -> In use
Port 8002 -> Available
The API is then started using:
http://localhost:8002
The selected URL is printed in the console.
The Windows launcher uses the PHP built-in development server.
The command is conceptually:
php.exe -S localhost:PORT -t apiThe API directory is:
api/
The entry point is:
api/index.php
A successful startup looks similar to:
========================================
Generic SQL API
========================================
[OK] PHP Runtime
[OK] PHP Configuration
[OK] Runtime Directories
[OK] PHP ODBC
Checking database connection...
[OK] Database Connected
[OK] API Directory
Checking available port...
[OK] Port 8000 Available
========================================
API Ready
========================================
API: http://localhost:8000
Starting API...
If 8000 is unavailable, another port is selected automatically.
The API can also be hosted using Apache with PHP.
The general architecture is:
Client
|
v
Apache
|
v
PHP
|
v
Generic SQL API
|
v
ODBC
|
v
SQL Server
The bundled PHP runtime is primarily intended to simplify Windows deployment and does not require Apache.
XAMPP can also be used if it is already part of the deployment environment.
However, XAMPP is not required when using the bundled Windows runtime.
The project can run directly with:
start-windows.batThis avoids making XAMPP a dependency of the application.
The API can be hosted through IIS using PHP/FastCGI.
The architecture becomes:
Client
|
v
IIS
|
v
FastCGI
|
v
PHP
|
v
Generic SQL API
|
v
SQL Server
The IIS environment must have a working PHP installation and PHP ODBC extension.
Nginx can be used with PHP-FPM.
Client
|
v
Nginx
|
v
PHP-FPM
|
v
Generic SQL API
|
v
ODBC
|
v
SQL Server
The PHP environment must provide the required ODBC functionality.
The backend can also be packaged into a Docker container.
A container would require:
PHP
PHP ODBC Extension
SQL Server ODBC Driver
Generic SQL API
Conceptually:
Docker Container
|
+-- PHP
|
+-- ODBC
|
+-- Generic SQL API
|
v
SQL Server
Database credentials should be supplied through the deployment environment rather than committed into the container image.
Docker support is part of future deployment work.
The PHP built-in server is convenient for local development and simple internal deployments.
For larger production environments, the API can be placed behind a proper web server such as:
- Apache
- IIS
- Nginx
A production deployment should also provide:
- HTTPS
- Restricted CORS
- Protected database credentials
- Appropriate authentication
- Firewall rules
- Database backups
- Application logging
- PHP updates
- ODBC driver updates
Do not expose SQL Server directly to the public Internet.
The recommended flow is:
Internet
|
v
HTTPS
|
v
Web Server
|
v
Generic SQL API
|
v
Private Network
|
v
SQL Server
Protect:
database/config/database.json
and never commit production credentials.
The bundled Windows runtime is part of the repository.
When updating PHP:
- Obtain a compatible PHP build.
- Replace the runtime files.
- Keep the required extensions enabled.
- Verify
php.ini. - Verify the ODBC extension.
- Run the startup script.
- Confirm the database connection.
- Test the API.
Check the PHP version with:
runtime\windows\php\php.exe -vCheck ODBC with:
runtime\windows\php\php.exe -m | findstr /i odbcThe PHP runtime and the SQL Server ODBC driver are separate components.
Application
|
v
Bundled PHP
|
v
PHP ODBC Extension
|
v
Installed ODBC Driver
|
v
SQL Server
The ODBC driver can therefore be updated independently from the PHP runtime, provided the installed driver remains compatible with the application.
Linux hosting can use a normal PHP installation with the required ODBC components.
The project does not currently provide a bundled Linux runtime.
Linux-specific runtime packaging and startup scripts are planned for a future release.
Check:
runtime/windows/php/php.exe
Then run:
runtime\windows\php\php.exe -vCheck:
runtime/windows/php/php.ini
Then run:
runtime\windows\php\php.exe --iniRun:
runtime\windows\php\php.exe -m | findstr /i odbcIf odbc is not displayed, check the PHP runtime and php.ini.
Check:
database/config/database.json
Then verify:
- SQL Server is running
- Server name is correct
- Database name is correct
- Authentication details are correct
- ODBC driver is installed
- SQL Server accepts the configured connection
- Firewall rules allow the connection
The Windows startup script automatically checks another port between:
8000
and:
8100
No manual port selection is normally required.