send2vinnie / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Examples of embedding other scripting languages using PHP Desktop infrastructure #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When Mongoose web-server gets implemented (Issue 14), we will be able
to embed any scripting language that provides a CGI executable. To do
this you would need to make only a single change to the settings.json
file by changing "cgi_executable" path. We might as well provide binary
examples of such embedding on the main page.

Original issue reported on code.google.com by czarek.t...@gmail.com on 17 Jan 2013 at 7:32

GoogleCodeExporter commented 9 years ago
Python tested and works fine with Mongoose, the config file is:

  cgi_interpreter C:\python27_32bit\python.exe
  cgi_pattern **.py$|**.pyc$

Example py script:

  import sys
  print("Content-Type: text/html")
  print("")
  print("Hello world from Python!<br>")
  print("Python version: %s" % sys.version)

Original comment by czarek.t...@gmail.com on 17 Jan 2013 at 7:45

GoogleCodeExporter commented 9 years ago
Perl also works fine, the config file is:

  cgi_interpreter perl-5.16.2.1-32bit\perl\bin\perl.exe
  cgi_pattern **.pl$

Example perl script:

  print "Content-Type: text/html\n";
  print "\n";
  print "Hello World from Perl!<br>";
  print "Perl version: " . $^V;

Original comment by czarek.t...@gmail.com on 17 Jan 2013 at 7:54

GoogleCodeExporter commented 9 years ago
Add index_files option to mongoose.conf so that script is executed
immediately without displaying directory listing:

  index_files index.py,index.pyc

The same for perl & ruby.

Original comment by czarek.t...@gmail.com on 17 Jan 2013 at 8:02

GoogleCodeExporter commented 9 years ago
Ruby works fine, example config:

  cgi_interpreter ruby-1.9.3-p362-i386-mingw32\bin\ruby.exe
  cgi_pattern **.rb$
  index_files index.rb

Example script:

  puts "Content-Type: text/html"
  puts ""
  puts "Hello world from Ruby!<br>"
  puts "Ruby version: ", RUBY_VERSION

Output:

  Hello world from Ruby!
  Ruby version: 1.9.3

Original comment by czarek.t...@gmail.com on 17 Jan 2013 at 8:09

GoogleCodeExporter commented 9 years ago
Examples for Perl, Python & Ruby created, see this wiki page for downloads:
http://code.google.com/p/phpdesktop/wiki/EmbeddingOtherScriptingLanguages

Original comment by czarek.t...@gmail.com on 19 Jan 2013 at 11:29