NW.js with Apache & PHP is a mod for NW.js that allows you to run an Apache server and PHP in the background. On startup, it opens index.html, redirects to index.php, and displays the rendered page in NW.js's Chromium browser.
This setup uses:
- Apache 2.4.63-250207-win64
- PHP 8.4.4-Win32-vs17-x64
- Starts Apache and PHP automatically in the background.
- Opens
index.htmlon load, then redirects toindex.php. - Displays the rendered PHP page in NW.js's Chromium browser.
- Supports video/audio playback (requires FFmpeg).
-
NW.js Windows 64-bit
Download the SDK version if you want access to DevTools:
NW.js Downloads -
Microsoft Visual C++ Redistributable
Required for running Apache and PHP:
Download VC++ Redistributable
- FFmpeg Prebuilt Binaries for NW.js
If you want to play videos or audio, download FFmpeg prebuilt binaries and placeffmpeg.dllinside the NW.js folder (wherenw.exeis located).
FFmpeg for NW.js
-
Download NW.js
Download the Windows 64-bit SDK version of NW.js from the official website:
NW.js Downloads -
Install Microsoft Visual C++ Redistributable
Install the latest version of the Microsoft Visual C++ Redistributable:
Download VC++ Redistributable -
Add FFmpeg (Optional)
If you need video/audio support, download FFmpeg prebuilt binaries for NW.js and placeffmpeg.dllin the NW.js folder (wherenw.exeis located). -
Upload
package.nw- Place the
package.nwfolder/directory inside the NW.js folder (wherenw.exeis located).
- Place the
-
Run NW.js
Launchnw.exeto start the application. Apache and PHP will start automatically in the background, and the app will openindex.html, redirecting toindex.php.
- The application will automatically start Apache and PHP when launched.
- It will open
index.html, which redirects toindex.php. - The rendered PHP page will be displayed in NW.js's Chromium browser.
- Ensure that no other service is using port
80(default Apache port). If port80is occupied, modify the Apache configuration to use a different port. - If you encounter issues with PHP not working, verify that the PHP binaries are correctly configured in the Apache settings.
- For development purposes, you can enable DevTools by downloading the SDK version of NW.js.
This project is licensed under the MIT License. See the LICENSE file for details.
- NW.js: https://nwjs.io/
- Apache HTTP Server: https://httpd.apache.org/
- PHP: https://www.php.net/
- FFmpeg for NW.js: https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt
Feel free to contribute or report issues!
Happy coding! 🚀