Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use this electron-php as server (php + mysql) #1

Open
AskDesignTeam opened this issue Oct 22, 2022 · 1 comment
Open

Use this electron-php as server (php + mysql) #1

AskDesignTeam opened this issue Oct 22, 2022 · 1 comment

Comments

@AskDesignTeam
Copy link

hello
its possible to use electron-php as server like wampserver ? and work with php + mysql ?
i want to install to my client as a server on offline mode and work directly on chrome and access to server with http://localhost (link to access to my app)

@virtualheart
Copy link

Hi @AskDesignTeam,

Yes, the steps and code below make it possible.

  1. Download MariaDB server (mariadb-<version>-winx64.zip) from the official website: https://mariadb.org/download/
  2. Extract zip file to foundation folder and rename it
  3. Add the example code below (Add this, line 7 in main.js).
  4. First time manually run ./mariaDB/bin/mariadb-install-db.exe or ./mariaDB/bin/mysql_install_db.exe (its create data folder)
  5. Download and use adminer.php for database easy access(recommended)
const { spawn } = require('child_process');

const childProcess = spawn(`${__dirname}/foundation/mariaDB/bin/mysqld.exe`, [], {
    detached: true, // Use 'detached' option if you want the child process to continue running even if the parent process exits
    stdio: 'ignore'  // Use 'ignore' to ignore standard I/O streams (you can customize this as needed)
  });

  // Optionally, you can listen for events on the child process
  childProcess.on('close', (code) => {
    console.log(`Child process exited with code ${code}`);
  });

  childProcess.on('error', (err) => {
    console.error(`Child process error: ${err}`);
  });

(It may help somebody)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants