Fixed PHP detection
This commit is contained in:
parent
06532b037a
commit
b6eeb0ef03
1 changed files with 21 additions and 18 deletions
|
|
@ -9,6 +9,9 @@ var phpwebkit = {
|
||||||
var pw = this;
|
var pw = this;
|
||||||
|
|
||||||
process.on('uncaughtException', function(err){
|
process.on('uncaughtException', function(err){
|
||||||
|
if(err == "Error: spawn php-cgi ENOENT") {
|
||||||
|
err = "Error: PHP doesn't appear to be installed";
|
||||||
|
}
|
||||||
pw.changeState('<strong>'+err+'</strong>', '#CD0000');
|
pw.changeState('<strong>'+err+'</strong>', '#CD0000');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -27,12 +30,6 @@ var phpwebkit = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fileExists(bin, function(result){
|
|
||||||
if(result === false) {
|
|
||||||
return 'php-cgi';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var path = gui.App.manifest.phpwebkit.path;
|
var path = gui.App.manifest.phpwebkit.path;
|
||||||
if(path === undefined || path == "") {
|
if(path === undefined || path == "") {
|
||||||
path = './application';
|
path = './application';
|
||||||
|
|
@ -48,16 +45,22 @@ var phpwebkit = {
|
||||||
port = 0;
|
port = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = {
|
this.fileExists(bin, function(result){
|
||||||
"path": path,
|
if(result === false) {
|
||||||
"bin": bin,
|
bin = 'php-cgi';
|
||||||
"host": host,
|
}
|
||||||
"port": port,
|
|
||||||
"arguments": gui.App.argv,
|
|
||||||
"manifest": gui.App.manifest
|
|
||||||
}
|
|
||||||
|
|
||||||
this.startServer(config);
|
var config = {
|
||||||
|
"path": path,
|
||||||
|
"bin": bin,
|
||||||
|
"host": host,
|
||||||
|
"port": port,
|
||||||
|
"arguments": gui.App.argv,
|
||||||
|
"manifest": gui.App.manifest
|
||||||
|
}
|
||||||
|
|
||||||
|
phpwebkit.startServer(config);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
startServer: function(config, callback){
|
startServer: function(config, callback){
|
||||||
|
|
@ -78,7 +81,7 @@ var phpwebkit = {
|
||||||
pw.changeState('Starting application...', '#00CD00');
|
pw.changeState('Starting application...', '#00CD00');
|
||||||
window.location = 'http://'+host+':'+server.address().port +'/';
|
window.location = 'http://'+host+':'+server.address().port +'/';
|
||||||
}).on('error', function(err) {
|
}).on('error', function(err) {
|
||||||
pw.changeState('<strong>Error: '+server.err+'</strong>', '#CD0000');
|
pw.changeState('<strong>Error: '+err+'</strong>', '#CD0000');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -93,9 +96,9 @@ var phpwebkit = {
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
fs.stat(file, function(err, stats) {
|
fs.stat(file, function(err, stats) {
|
||||||
if(!err && stats.isFile()) {
|
if(!err && stats.isFile()) {
|
||||||
return true;
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
callback(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue