An easy-to-use Electron application that integrates PHP and MySQL, providing a seamless development environment for desktop applications with web technologies. This application embeds a web view that loads content from a local PHP server.
- Electron-based desktop application with embedded web view
- Integrated PHP server running on port 5555
- Bundled MySQL server
- phpMyAdmin for database management
- Windows support (contributions for macOS and Linux support are welcome)
Before you begin, ensure you have met the following requirements:
To install Electron-PHP-MySQL, follow these steps:
-
Clone the repository:
git clone https://github.com/TerminalDZ/electron-php-mysql.git -
Navigate to the project directory:
cd electron-php-mysql -
Install the dependencies:
npm install
To run the application:
npm start
This command will:
- Start the MySQL server
- Launch the PHP development server on port 5555
- Start a separate PHP server for phpMyAdmin
- Open the Electron application window with an embedded iframe loading content from
http://localhost:5555
You can access phpMyAdmin by:
- Clicking on "File" > "Open phpMyAdmin" in the application menu
- Navigating to
http://127.0.0.1:2053/index.phpin your web browser
Default MySQL credentials:
- Username: root
- Password: (empty)
The application uses the following default ports:
- MYSQL_PORT (MySQL): 3306
- PHP_PORT (main application): 5555
- PHPMYADMIN_PORT (phpMyAdmin): 2053
You can modify these ports in the main.js file.
PHP server settings can be adjusted in the startPHPServer function in main.js.
MySQL configuration is defined in the mySqlConfig array in main.js.
main.js: The main Electron process filerenderer.js: The renderer process fileapp.html: The main application HTML file containing the iframepublic_html/: Directory for your PHP files (served athttp://localhost:5555)mysql/: Contains the MySQL server filesphp/: Contains the PHP executable and related filesphpmyadmin/: Contains the phpMyAdmin files
- Modify the PHP files in the
public_html/directory to change the application's functionality. - Adjust the Electron window settings in the
createWindow()function inmain.js. - Customize the application menu by modifying the
createMenu()function inmain.js. - Update the
app.htmlfile if you need to modify the iframe or add additional content to the main window.
- Use
console.log()statements inmain.jsfor server-side logging. - Access the Chromium Developer Tools for the renderer process via View > Toggle Developer Tools.
- To debug the PHP content, use appropriate PHP debugging techniques within your
public_html/files.
To create a distributable for Windows:
npm run package-win
This will create distributables in the release-builds/ directory.
Contributions to Electron-PHP-MySQL are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature) - Make your changes
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
We especially welcome contributions to add support for macOS and Linux platforms.
If you have any questions or suggestions, please feel free to contact us:
- Email: boukemoucheidriss@gmail.com
- WhatsApp: +213558601124
- Instagram: @idriss_boukmouche
- oscarotero/php-server-manager for PHP server management
- Electron for the application framework
- MySQL for database management
- phpMyAdmin for database administration
- ELECTRON-4-PHP for the initial project idea