Page 1 of 1
Dynamic CD Site
Posted: Fri Jan 16, 2004 12:47 am
by basdog22
Is it possible to create a dynamic site that will run from a CD???
I thought that if i created an XML backend and run the scripts from within php itself it is possible.
anyone to correct me???
Posted: Fri Jan 16, 2004 1:50 pm
by ilovetoast
I've seen claims it can be done, but have never done it myself. Everyone I have ever seen turned out to be flash or javascript only...
Posted: Fri Jan 16, 2004 2:39 pm
by basdog22
I think it can be done but i need someone to onfirm.
I use DEV-PHP to code php and it has a button that when pushed the code is parsed ok. So if there is a way to do this on a CD....
Posted: Sun Jan 18, 2004 2:55 pm
by Fredix
I guess there is a "PHP-compiler" out there. You need one if I understood you right.
Posted: Sun Jan 18, 2004 10:47 pm
by nufferkay
But compiled PHP would be limited to a single platform, no? I suppose if you were only dealing with one platform that would be OK....
Posted: Mon Jan 19, 2004 12:49 am
by basdog22
any way to send the php commands directly to the php.exe?
Posted: Mon Jan 19, 2004 11:30 am
by nufferkay
*confused*
Is php.exe the Windows version of the PHP interpreter?
Posted: Mon Jan 19, 2004 2:27 pm
by basdog22
yes
BTW i know it is very difficult (the whole idea) but since there are programs that just send the php commands to the php interpreter i think it is possible to identify the OS the CD is running on and send the commands to the right interpreter.
can this be done or must i forget about it???
Posted: Mon Jan 19, 2004 3:02 pm
by nufferkay
If you can write (or maybe find online) a cross-platform executable that will detect the platform it's running on, and then use that to choose the interpreter, I don't see why not...
So you're basically trying to build a PHP app that you can run off a CD?
Posted: Mon Jan 19, 2004 3:10 pm
by basdog22
........no
I just want to know if this can happen.
maybe i write php and someone else creates this prog. (total noob when it comes to compile something)

Posted: Mon Jan 19, 2004 3:44 pm
by nufferkay
Well, here's a quick (and grossly oversimplified) crash course on how compiled code works:
Basically, most programs you run (such as .exe programs on Windows) are binaries (this means that all the commands that are executed are represented in the 0's and 1's that computer hardware understands).
To get a binary, you compile code from a higher-level language - C and C++ are two of the most common compiled languages. The compiler translates the C/C++ code into a binary that will be properly understood by a particular processor type and operating system. In many cases, you can use the same C or C++ code to create binaries for more than one platform, but each binary works only on the platform it was created for. Most applications are distributed as binaries rather than higher-level code.
PHP is an interpreted language. That means that instead of being distributed as a binary, each script is translated into binary each time it is run. The translating program is called an interpreter, and it is almost always a binary. There is a different interpreter binary for each platform, but they all interpret the PHP the same way. This means that you can distribute the same PHP script for any and every platform, because the interpreter will understand it the same way.
PHP's interpreter is usually a module (sort of like a plugin) for the Apache web server. However, there are a few apps out there that will interpret PHP without a server, or even compile it into binary form that can run on its own without a separate interpreter (although this is more commonly done with Perl). But of course, once you've compiled it into a binary, it is no longer effortlessly cross-platform, the way the initial script was.
If you wanted to distribute a PHP app on a CD without requiring anything else on the user's computer to be able to run, and that would work on most common operating systems and hardware, you would have to either:
a) compile a different binary for each platform and include them all on the CD
b) include a PHP interpreter for each platform on the CD, along with the plain-old PHP scripts you wrote.
Or, if you know that everyone who uses the CD will have Apache with PHP installed, you might be able to get it to use the scripts on the CD - but I'm not sure whether Apache is capable of doing this.
Hope that makes sense.
-N
Posted: Tue Jan 20, 2004 3:47 am
by basdog22
thanks nuf...