aj-techsoul / ELECTRON-4-PHP

An easiest way to use php in electron
MIT License
202 stars 46 forks source link

Setup on Windows Problem #12

Closed oleteacher closed 5 years ago

oleteacher commented 5 years ago

Greetings, awesome project! Have been wanting to learn more about electron, especially with PHP.

I have installed using GIT and can start (npm start) but showing "PHP server not started. Retrying..."

Running Windows 10. Here is my config:

const PHPServer = require('php-server-manager');

const server = new PHPServer({
    port: 5555,
    directory: __dirname,
    directives: {
        display_errors: 0,
        expose_php: 0
    }
});

server.run();

Sure it is something I do not understand about configuring main.js

Could you give me example of what you have working for Windows?

Thanks!

aj-techsoul commented 5 years ago

Please try restarting the computer and try again. actually windows sometimes doesn't seems to know that php is installed. So this error may occur. After Restarting if problem persists then try checking the directory permissions and also make sure you doing all these things as Administrator with full access otherwise downgrade the UAC to zero and try again after restarting. And do let me know if this helps.

On Fri, Dec 21, 2018 at 6:12 AM Susan notifications@github.com wrote:

Greetings, awesome project! Have been wanting to learn more about electron, especially with PHP.

I have installed using GIT and can start (npm start) but showing "PHP server not started. Retrying..."

Running Windows 10. Here is my config:

const PHPServer = require('php-server-manager');

const server = new PHPServer({ port: 5555, directory: __dirname, directives: { display_errors: 0, expose_php: 0 } });

server.run();

Sure it is something I do not understand about configuring main.js

Could you give me example of what you have working for Windows?

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AJ-TechSoul/ELECTRON-4-PHP/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AZ_IILY_MUuLxOGN6qL7oBKGB586ZSRfks5u7C5ygaJpZM4ZdJia .

oleteacher commented 5 years ago

I did a restart and still have issue. Little more info shown:

PHP Server error { Error: spawn php ENOENT
    at exports._errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:607:11)
    at startup (bootstrap_node.js:167:16)
    at bootstrap_node.js:589:3
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn php',
  path: 'php',
  spawnargs:
   [ '-S',
     '127.0.0.1:5555',
     '-t',
     'F:\\Electron\\ELECTRON-4-PHP',
     '-d',
     'display_errors=0',
     '-d',
     'expose_php=0' ] }
PHP Server closed

Never had directory permission issues or have to run as admin before, but will try those things later. Will also try on different computer this evening.

So I understand "otherwise downgrade the UAC to zero", where is this setting?

Thanks!

oleteacher commented 5 years ago

Maybe I am not understanding where PHP should be on drive.

I see a "php" folder within the ELECTRON-4-PHP folder and would assume, there is no need for PHP to be installed on every machine before using app?

aj-techsoul commented 5 years ago

screen shot 2018-12-23 at 11 23 55 am

i think you have downloaded the general one, download from here the separate for windows https://github.com/AJ-TechSoul/ELECTRON-4-PHP/tree/Electron-4-PHP-Windows

Actually both has only one difference, For Windows i have put PHP in it. And for general or other OS they come by cmd-line. So go on try this and let me know.

Another thing To turn off UAC: Click the Start menu. In the search field type UAC. Click "Change User Account Control settings." In the window that comes up, move the slider down to "Never Notify." Click OK and then restart the computer.

That will work great, actually for Linux and Mac we have Root Access which prompts when application needs to run as root. But in Windows they tried to make something like that which sometimes annoying because they don't prompt but directly stops it.

Do let me know does this help, if not tell me what you facing again. If suppose after all it doesn't work then double click on "setenv.bat" file which will do the necessary changes in your environment. Thanks for letting me know the problems you all facing so that i could fix or guide you for the same :)

juppwerner commented 5 years ago

Hi,

I had the same issue.

I have installed the xampp package, and I had C:\xampp\php in my PATH environment variable. So the phpinfo() here always showed the PHP installed with xampp.

I removed C:\xampp\php from my PATH in order to see the PHP info which came with the ELECTRON-4-PHP git package. Then it showed

PHP server not started. Retrying...

It works when you change main.js to add the path to the bundled PHP like this:

const server = new PHPServer({
    php: "php\\php.exe",  // <==== ADDED
    port: 5555,
    directory: __dirname,
    directives: {
        display_errors: 1,
        expose_php: 1
    }
});

Perhaps this should just be added to the README file?

Regards Joachim

aj-techsoul commented 5 years ago

@juppwerner hmm does it resolve the issue. If yes then i will add this is master file too. Thanks man to support in it. :)

aj-techsoul commented 5 years ago

I have added the changes you said. @juppwerner

aj-techsoul commented 5 years ago

@juppwerner I have updated the Windows branch also. Kindly check in the Branch. https://github.com/AJ-TechSoul/ELECTRON-4-PHP/tree/Electron-4-PHP-Windows