laravel-electron icon indicating copy to clipboard operation
laravel-electron copied to clipboard

Any idea to make it work in macOS and Linux?

Open lfbn opened this issue 5 years ago • 4 comments

Because of PHP, for what I see this won't work as desktop application outside of Windows.

I was thinking, maybe it can be used, in main.js, instead of the node js PHP package, a copy of a builded PHP like the one extracted by https://php-osx.liip.ch/, if the operating system is macOS or Linux.

After making PHP working, it would be necessary to run the PHP with the built-in server.

I don't know if this will also work after packaging the application.

In short, if we include a standalone PHP copy, and check for the operating system, maybe this would work for all operating systems. Yes?

lfbn avatar May 02 '20 11:05 lfbn

Hi @lfbn ,

I ran into this too. The following fixed it for me.

In main.js:22 change bin to use the one on your machine:

  phpServer.createServer({
    port: port,
    hostname: host,
    base: `${__dirname}/www/public`,
    keepalive: false,
    open: false,
    bin: '/usr/bin/php',  // <---- this one here
    router: __dirname + '/www/server.php'
  });

I've also set the serverUrl manually to go right to the test route:

const serverUrl = `http://${host}:${port}/`;

Hope this fixes it for you too!

mtolhuys avatar May 11 '20 17:05 mtolhuys

Hi,

Nice tip.

But what I was thinking was, to have PHP included in the project. This way we don't need to install.

If I had time I will try to do it.

lfbn avatar May 19 '20 16:05 lfbn

Yeah i was successful after some experimenting it on MAC OS:

https://github.com/blackgeneration/Laravel-Electron-For-MAC-OS.git

The php is contained with the project :)

takumade avatar Oct 19 '20 14:10 takumade

This will work for Linux :)

https://github.com/mintech-dot/CRUD-Laravel-electronjs/

mintech-dot avatar Oct 08 '22 14:10 mintech-dot