Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 PHP Server
Index -> Programming, PHP -> PHP Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
beard0




PostPosted: Tue Aug 31, 2004 8:51 pm   Post subject: PHP Server

I'm writing my own web server in turing - and before you jump on me telling me this is the PHP help forum - what I'm looking for is help on how to comunicate with the php install that I got from php.net. Does anyone know how I would go about calling on it to interpret a file for me, and then give me the neccessary information to then send that to the client?
Thanks!
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sun Sep 05, 2004 9:25 am   Post subject: (No subject)

Wow, that is some project. I am not shure if it whould be posable to directly intreface turing and php like that, since turings comands realting to anything out side it's self are limited. What you may have to do is write your own inturpiter for php or many be kind of trick it in to work with turing by using a web server that dose work with php and then geting the out put from it when it reads the php file.

May be some one who knows more about the inner workings of php can post and let us know if it whould be posable to get data from it with the limited comands turing has....
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
rizzix




PostPosted: Sun Sep 05, 2004 10:25 am   Post subject: (No subject)

ok try this

/location/to/php.exe somephpfile.php

u need to somehow grab output from STDOUT (i dont know how the hell you do that in turing... unless its automatically done for you.. and you will know this if the turing command to execute external programs is a function returning a string)
Dan




PostPosted: Sun Sep 05, 2004 12:48 pm   Post subject: (No subject)

ya thats the thing tho, i know turing can pass arugements to progmaes but i have yet to find any way of geting it to read stdin/stdout from them. The only way i could think of whould be to posable mess with pointers in turing so they will grabe the data in the ram adderes from that progame. but that whould be extreamly hard to do and i am not even shure if turing could do it ether.

I am thinking your bests bets whould be to make it read a file outputed by the php some how or write your own php interditer in turing.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
rizzix




PostPosted: Sun Sep 05, 2004 1:35 pm   Post subject: (No subject)

what about cheat and unchecked pointers. that might be the way.. i;ll give it a shot tonight.
Catalyst




PostPosted: Sun Sep 05, 2004 4:09 pm   Post subject: (No subject)

you could write another small program that runs the php.exe then dumps stdout to a temp file that turing can go and fetch
rizzix




PostPosted: Sun Sep 05, 2004 4:30 pm   Post subject: (No subject)

yea that should be the last resort.. cuz it would slow thing down a lot.
wtd




PostPosted: Sun Sep 05, 2004 11:58 pm   Post subject: (No subject)

Doesn't Turing have some kind of system(prog_name) function?
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Mon Sep 06, 2004 7:40 am   Post subject: (No subject)

It does, but as has been stated above, I can run the php.exe, with the desred file as an argument, bu I can not (or at least don't know how to) then access the STDOUT, which is the whole purpose of running php.exe.
wtd




PostPosted: Tue Sep 07, 2004 6:54 pm   Post subject: (No subject)

Does the system() function return the output of the program?
Dan




PostPosted: Tue Sep 07, 2004 8:46 pm   Post subject: (No subject)

No, just a int repsenting the if the comand was scusful or not and if not what error hapened.

I checked the sys comands and i could not see anything that whould be very helpfull for this.

Edit: i think the easyest way to do this whould be writing a 2nd progame that can comintacte between php and turing that is not writen in turing. The problem tho is that u whould have to time the reading and writing of the file right and it could be slow. Also if u are going to be doing that why not just make the webserver in that 2nd lang.

The way that whould fuction the best whould be writing your own code to read the php file and then out the same thing php.exe whould or coming up with some ingeuses way of tricking turing in to setaling the stout data like by messing with pointers.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
beard0




PostPosted: Wed Sep 08, 2004 1:52 pm   Post subject: (No subject)

Thanks for all the help. It looks like the answer is trying to read stout, with pointers. Which means my problem now is a turing problem. I'll have to read up on how to use pointers in turing.

Thanks again!
wtd




PostPosted: Wed Sep 08, 2004 2:51 pm   Post subject: (No subject)

Actually what I'd recommend is writing the output of the PHP command to a file ( system("php input.php > output.html") ), then reading that file.

Aside from using a language that's better at scripting tasks (Perl, Ruby, and possibly Python), this seems the best alternative.
beard0




PostPosted: Wed Sep 08, 2004 3:52 pm   Post subject: (No subject)

Oh wow! I didn't know of that nice little ">" command! That will do what I need at least temporarily. I can look into other methods to improve speed later. Thanks!
rizzix




PostPosted: Wed Sep 08, 2004 5:54 pm   Post subject: (No subject)

yep as i said.. performance.. hmm but to think again.. i dont think there's another way around.. hmm.. the new OS's would immediatly terminate ur program if u try doing something funny like that.
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 24 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: