Convert Any PHP & MySQL Web Application into Desktop Software (.EXE)


Have you built a Billing Software, School Management System, vCard Builder, or Inventory App in PHP and MySQL, and now want to use or sell it to clients as Windows Desktop Software (.EXE)?

In this tutorial, we will learn how to convert a PHP and MySQL website into a Windows desktop software in .exe format. Once converted, your PHP and MySQL project will open directly on the desktop like a regular Windows program. You won't need XAMPP or any external web server; the .exe file can be installed easily on any Windows PC, and the database will work the exact same way.

Most developers think you have to learn C#, Java, or Electron.js to build desktop software. The reality is that you can convert your existing PHP web application into a professional Windows .exe installer— where your client doesn't have to install XAMPP or WAMP on their computer at all.

In this tutorial, we will cover the following step by step:

  • Offline Desktop Software: Converting your MySQL database into a lightweight, self-contained SQLite file (database.sqlite) so the software runs without the internet and without XAMPP.
  • Online Desktop Software: Setting up a remote MySQL PDO connection if you want your desktop app to connect to a live server database.
  • Packaging & Installer: Building a professional Setup.exe installer using PHP Desktop and Inno Setup.

Whenever someone opens the software on their PC, it works just like a native Windows app.

To do this, we will need three free Windows tools that you can download at no cost:

Software / Tool What It Does
PHP Desktop Chrome Runs your PHP code inside a desktop window (Chromium browser + built-in PHP server) without needing XAMPP.
DB Browser for SQLite Imports and manages your SQL data inside a database.sqlite file.
Inno Setup Compiler Packages your entire project folder into a single, professional Windows Setup.exe installer.

Step 1: Convert Your MySQL Database (.sql) to SQLite Format

As you already know, running a MySQL database requires a server like XAMPP, WAMP, or MySQL Server. SQLite, on the other hand, is just a single file (database.sqlite) that PHP can read directly.

  1. Open phpMyAdmin and export your MySQL database as a .sql file.
  2. A MySQL .sql dump will not run directly in SQLite because it contains MySQL-specific syntax like ENGINE=InnoDB, AUTO_INCREMENT, and ALTER TABLE keys at the bottom.
  3. Open our Free MySQL to SQLite Converter Online tool and upload or paste your .sql file.
  4. Keep "DB Browser Safe Mode" and "Auto-Fix phpMyAdmin Keys" turned ON, then click Convert.
  5. Copy the converted SQLite code.

Step 2: Create the database.sqlite File Using DB Browser

  1. Install DB Browser for SQLite.
    • Installation Tip: On the Shortcuts screen, only select Desktop and Program Menu shortcuts for DB Browser (SQLite). Leave DB Browser (SQLCipher) unchecked, as normal projects don't need it.
  2. Open DB Browser and click New Database at the top.
  3. Name the file database.sqlite and save it. (If an "Edit table definition" popup appears, simply click Cancel.)
  4. Go to the Execute SQL tab and paste the entire SQLite code you converted in Step 1.
    • Important Note: Make sure the script does not contain BEGIN TRANSACTION;, COMMIT;, or PRAGMA foreign_keys = ON; at the end—otherwise DB Browser may throw a transaction error or show a popup.
  5. Click the blue Play (▶) button at the top. You should see "Query executed successfully" at the bottom.
  6. Switch to the Database Structure tab and confirm that all your tables (such as users, general, etc.) are listed there. It should not show Tables (0).
  7. Most Important Step: Click the Write Changes button in the top menu bar, and then close DB Browser.

(Right-click your database.sqlite file → Properties to confirm that its file size is greater than 0 KB.)

Step 3: Set Up PHP Desktop and Copy Your Project Files

  1. Extract the downloaded PHP Desktop Chrome ZIP file (for example, phpdesktop-chrome-130.1-php-8.3).
  2. Inside the extracted folder, you will find a www folder. Delete all the default demo files inside it.
  3. Paste all your PHP project files along with your newly created database.sqlite file into this www folder.

Customize the App Name and Window (settings.json)

Open the settings.json file inside the main PHP Desktop folder using Notepad++ (or any code editor) and update it as shown below:

{
    "debugging": {
        "show_console": false
    },
    "main_window": {
        "title": "My PHP Desktop Software v1.0",
        "icon": "www/assets/images/app-icon.ico",
        "default_size": [1280, 800],
        "start_maximized": true
    },
    "web_server": {
        "listen_on": ["127.0.0.1", 0],
        "www_directory": "www",
        "index_files": ["index.php", "index.html"]
    }
}
  • Tip: Keep "show_console": true while testing so that if any PHP error occurs, you can see it in the black console window. Change it back to false before building your final .exe.
  • You can also rename phpdesktop-chrome.exe to your own software name (for example, my-software.exe).

Step 4: Update Your PHP PDO Database Connection

Now open your project's actual database connection file. (Make sure to check your autoload.php or index.php first to confirm which config file your project is really loading—such as pdo-config-ts.php or includes/config.php. Editing the wrong file will prevent the connection from working.)

Remove your old MySQL connection lines and replace them with the SQLite PDO code below. Using __DIR__ prevents file path issues:

<?php
try {
    // If this file is directly inside the 'www' folder (alongside database.sqlite):
    $dbPath = __DIR__ . '/database.sqlite';

    // Note: If this file is inside 'www/includes/', use the line below instead:
    // $dbPath = dirname(__DIR__) . '/database.sqlite';

    $db = new PDO("sqlite:" . $dbPath);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);

} catch (PDOException $e) {
    die("SQLite Database Connection Error: " . $e->getMessage());
}
?>

Step 5: Test Locally Before Building the Installer

Before running Inno Setup, go into your PHP Desktop folder and double-click phpdesktop-chrome.exe (or your renamed .exe file).

  • Your software will launch inside a native Windows desktop window.
  • Thoroughly test login, data entry, and reports. Move on to the next step only after confirming everything works smoothly without any errors.

Step 6: Create a Professional Windows Installer (Setup.exe) with Inno Setup

Now we will package the entire folder into a single Setup.exe file so any user can install it on their computer with a simple Next → Next → Finish wizard:

  1. Open Inno Setup Compiler.
  2. Select Create a new script file using the Script Wizard and click OK.
  3. Application Information: Enter your software name, version (e.g., 1.0), company/brand name, and website URL.
  4. Application Files (Most Important Step):
    • Under Application main executable file, select the main .exe file inside your PHP Desktop folder.
    • Right below that, click the Add folder... button and select your entire PHP Desktop folder.
    • When prompted with "Should files in subfolders also be included?", click Yes.
  5. Application Shortcuts: Keep the Desktop shortcut option checked so your software icon appears on the user's desktop after installation.
  6. Compiler Settings: Choose an output folder, set your Setup filename (e.g., MySoftware_Setup), and browse for a custom .ico icon if you have one.
  7. Once the wizard finishes, click Finish and choose Yes when asked "Would you like to compile the new script now?" (or click the green Compile ▶ button at the top).

Within a few seconds, your ready-to-use Windows Installer (Setup.exe) will be generated inside the Output folder.

Troubleshooting: 4 Common Errors and Their Quick Fixes

Developers most commonly run into these 4 errors when packaging a real PHP project:

  1. Error: Fatal error: SQLSTATE[HY000]: General error: 1 no such table: ...
    • Cause: Your database.sqlite file is empty (Tables (0)), or you forgot to click Write Changes after running the SQL query in DB Browser.
    • Fix: Import the SQL data in DB Browser and click Write Changes. Also, if you already installed an earlier broken build on your PC, uninstall it first from Control Panel → Uninstall a program, then install the new Setup.exe.
  2. Error: Software keeps redirecting to the /install page
    • Cause: The file path to database.sqlite is incorrect (for example, config.php is inside the includes/ folder and looking for the database in the same folder), or you edited the wrong config file.
    • Fix: Check autoload.php to see which config file is loaded via require_once and set the exact path using __DIR__ or dirname(__DIR__).
  3. Error: cannot start a transaction within a transaction in DB Browser
    • Cause: Your SQL script starts with BEGIN TRANSACTION;, while DB Browser already opens a transaction automatically in the background.
    • Fix: Remove BEGIN TRANSACTION; and COMMIT; from the script, or always use "DB Browser Safe Mode" in our MySQL to SQLite Converter.
  4. Error: Execution aborted by user (on line PRAGMA foreign_keys = ON;)
    • Cause: Running a PRAGMA command at the end of the script triggers a commit confirmation popup in DB Browser, which can abort execution.
    • Fix: Delete the PRAGMA foreign_keys = ON; line at the very bottom before running the script, then click Write Changes.

Frequently Asked Questions (FAQs)

Q1: Does the client need XAMPP or PHP installed on their PC to run this .exe software?

No. PHP Desktop already bundles the PHP interpreter, local web server, and Chromium browser engine inside it. The client only needs to install your Setup.exe.

Q2: Do I have to rewrite all my MySQL queries in PHP for SQLite?

If you used standard PHP PDO prepared statements (SELECT, INSERT, UPDATE, DELETE), about 95% of your code will run directly on SQLite without any changes. You may only need to adjust a few MySQL-specific functions (such as replacing NOW() with datetime('now') or checking IFNULL).

Q3: Will printing and PDF generation work inside this desktop software?

Yes, completely. Because PHP Desktop runs on the Chromium (Chrome) engine under the hood, Bootstrap 5, JavaScript, window.print(), HTML2Canvas, and jsPDF all work smoothly.

Q4: What is the approximate size of the final software?

Since Chromium and PHP binaries are bundled together, the final Setup.exe size is usually between 70 MB and 120 MB, which is completely normal for a modern Windows desktop application.


Please Share