MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 208 forks source link

PHP? #73

Open IngwiePhoenix opened 11 years ago

IngwiePhoenix commented 11 years ago

Hey!

So, I have been using appJS before, and I was quite happy that I could use PHP within it, by just modifying a few lines of its bootstrap code - so it would call PHP on the index file and print the result into the browser window.

Unfortunately, I wasn't able to yet spot a function for that in MacGap.

I would like to be able to modify the file handlers, so I could run PHP code inside the app - most especially the Yii framework.

I am working on a package management system for Mac, so I need to have the things offline. Most of the code base is yet written, but it seems like that appS support has stopped, node-webkit doesnt let me modify the bootstrap script, and Titanium just wouldn't work at all on my mac.

Regards, Ingwie.

Fyb3roptik commented 11 years ago

AFAIK OS X 10.8 disables apache by default, so this solution would not be beneficial. I would suggest possibly saving the data to the sqllite database if it is implemented in macgap

IngwiePhoenix commented 11 years ago

Mac OS has PHP as a binary. By doing:

$ php PHPFILE.php

you can run a PHP file just like apache would. Then just take STDOUT to the browser - that is how i do it in appjs.

In nodejs:

$PHP = spawn("php",["PHPFILE.php"],{'env':{"DOCUMENT_ROOT":"./"}});
$PHP.stdout.on("data",function(data){ /* Collect data in a global var */ });
$PHP.stdout.on("end",function(data){ /* Stream to browser. */ });

I just need a way to execute native binarys from within MacGap and I'm all suited =) Am 28.05.2013 um 17:06 schrieb Nick Wallace notifications@github.com:

AFAIK OS X 10.8 disables apache by default, so this solution would not be beneficial. I would suggest possibly saving the data to the sqllite database if it is implemented in macgap

— Reply to this email directly or view it on GitHub.

jeff-h commented 10 years ago

As I've mentioned on a couple of other issues here, the Nodelike project (see https://github.com/node-app/Nodelike) provides a node.js-compatible API to web views. We've successfully combined Nodelike with MacGap, meaning javascript in MacGap can now have access to both the usual MacGap API as well as the node.js API.

See: https://github.com/node-app/macgap for a pre-combined package of MacGap plus Nodelike https://github.com/node-app/Nodelike/wiki/How-to-integrate-Nodelike-with-MacGap