Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Cheyenne and PHP

 [1/3] from: fergus4::bellatlantic::net at: 30-May-2007 16:28


Anyone know how to get php working with Cheyenne... I'm trying to get phpmyadmin working with Cheyenne Or Any other phpmyadmin-like tool. I've looked at myresql which works with Magic but I do not know if either works with Cheyenne... Any suggestions? Thanks -Alan

 [2/3] from: btiffin::rogers::com at: 30-May-2007 22:35


Have you been on Altme REBOL 3 today? Dockimbel is dropping hints in !Cheyenne forum :) with the new 9.10 beta. I haven't looked, but some edits may be required to turn it on... Cheers, Brian On Wednesday 30 May 2007 16:28, Alan wrote:

 [3/3] from: GedB::Rushcoding::co::uk at: 31-May-2007 8:48


I can't be too difficult. Here's my modified Micro Web Server which I used to test my PHP. REBOL [ Title: "Micro Web Server" Date: 10-Jun-2000 File: %webserver.r Purpose: { Here is a web server that works quite well and can be run from just about any machine. It's not only fast, but its also small so it's easy to enhance. } History: [ 10-Jun-2000 "Buffers the entire request, adds address" 22-Jun-1999 "First posted" 12-Jun-2007 "GB - Added support for PHP" ] Notes: { Set the web-dir to point to the file directory that contains your web site files, such as index.html. } library: [ level: 'intermediate platform: none type: none domain: [web other-net] tested-under: none support: none license: none see-also: none ] ] web-dir: %. ; the path to where you store your web files php-path: "^"C:\php\php.exe^"" listen-port: open/lines tcp://:8010 ; port used for web connections errors: [ 400 "Forbidden" "No permission to access:" 404 "Not Found" "File was not found:" ] send-error: function [err-num file] [err] [ err: find errors err-num insert http-port join "HTTP/1.0 " [ err-num " " err/2 "^/Content-type: text/html^/^/" <HTML> <TITLE> err/2 </TITLE> "<BODY><H1>SERVER-ERROR</H1><P>REBOL Webserver Error:" err/3 " " file newline <P> </BODY> </HTML> ] ] send-page: func [data mime] [ insert data rejoin ["HTTP/1.0 200 OK^/Content-type: " mime "^/^/"] write-io http-port data length? data ] do-php: function [file [string!]][result php-cmd] [ result: copy "" php-cmd: reduce [php-path "-f" web-dir/:file] call/wait/output php-cmd result result ] browse http://localhost:8010 buffer: make string! 1024 ; will auto-expand if needed open forever [ http-port: first wait listen-port clear buffer while [not empty? request: first http-port][ repend buffer [request newline] ] repend buffer ["Address: " http-port/host newline] print buffer file: "index.html" mime: "text/plain" php?: false parse buffer ["get" ["http" | "/ " | copy file to " "]] parse file [thru "." [ "html" (mime: "text/html") | "php" (mime: "text/html" php?: true) | "gif" (mime: "image/gif") | "jpg" (mime: "image/jpeg") ] ] any [ if not exists? web-dir/:file [send-error 404 file] if error? try [ either php? [ data: do-php file ][ data: read/binary web-dir/:file ] ][ send-error 400 file ] send-page data mime ] close http-port ]