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

Adding PHP #73

Open
2braincells2go opened this issue Jul 31, 2015 · 25 comments
Open

Adding PHP #73

2braincells2go opened this issue Jul 31, 2015 · 25 comments

Comments

@2braincells2go
Copy link

I know this is not an issue, but can't seem to figure any other way to ask...

Got a little project for upcoming school year. Need to run some basic PHP scripts in a Windows exe (maybe even MAC later). Is there an easy way to do this with Web2Exe? Maybe a good tutorial on the net somewhere you could refer me to?

Thank you much in advance!

@jyapayne
Copy link
Collaborator

You could always email, but I don't mind an issue for a question :)

There is a project that does this: https://github.com/baconface/php-webkit/

I just created a pull request to make it work on Mac: baconbrad/php-webkit#19

I just tested it, and it works! In order to get it to work, clone the repo, change into it's directory and then follow these steps:

  • Install dependencies with npm install
  • Download the php-cgi binary file for windows here and Mac using homebrew
  • Put the php-cgi[.exe] in the ./bin/php/ folder of the php-webkit project
  • Put your index.php app inside the ./application/ folder of the php-webkit project
  • Open up Web2Exe and open up the php-webkit repo folder. Choose your settings, export and run!

If the directions are unclear, let me know. Good luck with your project :)

@jyapayne
Copy link
Collaborator

Works on linux, too!

php-nodewebkit

@2braincells2go
Copy link
Author

Thanks Joey, your a champ!

After I posted here, it dawned on me could have used email. What happens when you near 60 years old... The brain cannot retrieve info faster then can type:)

Will give your recommendations a shot in the morning and see what happens.

Cheers!

@jyapayne
Copy link
Collaborator

:) No problem Woody, glad to help you out!

@2braincells2go
Copy link
Author

Hello Joey. Got side tracked with "life issues" and did not get back to this until now. Starting of school year make-a-me crazy:)

Far from a "npm" wizard. So I understand: Just running Web2Exe will not install the packages I need? Must run the npm install to make work? (on Windows btw).

I tried creating and get message upon startup of completed project:

Error: Cannot find module 'express'

Cannot get v0.2.4b to run at all on Windows 10 so using v0.2.3b if this makes any difference.

Thanks man!

@jyapayne
Copy link
Collaborator

jyapayne commented Sep 9, 2015

:) Yeah, you must run the "npm install" command, which will download the dependencies for php-webkit so that it will run. The error you are receiving is because of this. To install npm, follow this tutorial: http://blog.teamtreehouse.com/install-node-js-npm-windows

As for 0.2.4b not working on Windows 10, I haven't upgraded yet, so I can't test. Is there any error displayed? Or any errors in the error log file?

@2braincells2go
Copy link
Author

Thanks Joey, I had already installed npm and got the dependencies downloaded.

I get the app started but it turns to red screen showing:

Error: spawn ./bin/php/php-cgi.exe ENOENT

Guess I better head over to baconface and ask about that.

As for Win 10 & v0.2.4b no error messages, nothing. Simply does not start. Very strange. If you wish I can open a issue so it not get muddled with this.

@jyapayne
Copy link
Collaborator

jyapayne commented Sep 9, 2015

Sure, you can open a separate issue :)

As for the error you are getting now, you have to copy the PHP binary and put it in that folder. Unless you already did that, in which case I'm not sure what's up.

@2braincells2go
Copy link
Author

Think I am having issues with Win 10 and Web2Exe. First time I create project works fine, if I make changes and do second export with Web2Exe the output directory is not updated. Shows "making directories" and then "Done Exporting" real fast and no files actually updated.

Will do little experimenting to see if can give you more info when opening new issue.

Thanks again!

@jyapayne
Copy link
Collaborator

jyapayne commented Sep 9, 2015

I think that may be a bug with 0.2.3b, because I remember that issue happening before. When a get a chance, I'll try installing Windows 10 and see if I can find out what's happening.

Cheers!

@KillerSquid
Copy link

Any news on the Mac version? I'm getting that EACCES error and it keeps crapping out on my npm install.

@jyapayne
Copy link
Collaborator

You could always use my fork, which has the fix.

@KillerSquid
Copy link

Well your fork worked but when i launch it via web2executable I get Error: Cannot find module 'express'. Any ideas? I see the declaration in main.js and the package.json file. I tried cd'ing into the dir and running npm install https://www.npmjs.com/package/express but got a whole ton of errors.
Sorry for the beginner level questions. Still wrapping my brain around NW and NPM.

Here's my SS - I am root admin, btw:
screen shot 2015-10-28 at 12 15 44 pm

@jyapayne
Copy link
Collaborator

Hmmm, the correct way to run the command is just npm install, which will install all the requirements defined in the package.json, but you're way should work for that particular requirement. It's weird that you're getting that error if you are the root admin.

Check the permissions of the ~/.npm folder by running

ls -ld ~/.npm

@jyapayne
Copy link
Collaborator

Once you get that install working, it should be smooth sailing, though :) It's working on my Mac with no issues.

@jyapayne
Copy link
Collaborator

You can try running

sudo chown -R macmini ~/.npm

and then try running the npm install command again. That folder should be owned by you anyways, but just in case it's not :)

@KillerSquid
Copy link

Okay- that's just weird. I double-checked that I'm root admin, which I am, but my perms were set to 557. I tried the sudo chown method and then ran npm install and got a few warnings but no errors.

Express looks like it's good. Now I'm getting hung up with Error: write EPIPE. When I run with web2executable it just hangs on 'Starting application'.

Didn't know if you knew this was Dan. Just got your email. Thanks again for ALL your help on everything!

@jyapayne
Copy link
Collaborator

Yep, I knew it was you :) I always click on the username before I answer to see if it's someone I've talked to before. No worries about the help, glad to help where I can ;)

Hmm, is there any more information in the console of the exported application?

@KillerSquid
Copy link

This is from Terminal using just nw then the app location.
How do I get the console of the exported app?

2015-10-28 14:24:33.096 node-webkit Helper[2217:620283] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650 2015-10-28 14:24:34.991 node-webkit Helper[2218:620628] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650 [2216:1028/142437:ERROR:simple_backend_impl.cc(186)] File structure does not match the disk cache backend. [2216:1028/142437:ERROR:simple_backend_impl.cc(402)] Simple Cache Backend: wrong file structure on disk: /Users/macmini/Library/Application Support/php-webkit/Cache [2216:1028/142437:INFO:simple_index_file.cc(397)] Simple Cache Index is being restored from disk. [2216:1028/142437:INFO:CONSOLE(99)] "{"code":"ENOENT","errno":"ENOENT","syscall":"spawn"}", source: /Users/macmini/Dropbox/php-webkit-master/lib/bridge.js (99)

@jyapayne
Copy link
Collaborator

Ah, try copying the php-cgi binary into ./bin/php/ inside the php-webkit directory.

@KillerSquid
Copy link

I'm sorry man, where do I find the php-cgi binary? I see how to do it in homebrew but that installs it for the system from what I can see.

@jyapayne
Copy link
Collaborator

Ah, no worries. When you install it via homebrew, it will usually go into /usr/local/bin/php-cgi, if it's not there, you can see where it is by running

which php-cgi

and then copying that file to ./bin/php/.

@KillerSquid
Copy link

Nailed it. You're the awesomeist, bro. Thanks again!
Now I gotta stop playing with this and finishing this damn alpha.
(I hit 200,000+ lines this morning!)

@jyapayne
Copy link
Collaborator

;) Any time, dude.

Get that alpha done!

@sapioit
Copy link

sapioit commented Dec 18, 2015

Please keep this ticket open, or link to it in the readme.md

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

4 participants