Dynamic CD Site
Moderator: General Moderators
Dynamic CD Site
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???
I thought that if i created an XML backend and run the scripts from within php itself it is possible.
anyone to correct me???
-
ilovetoast
- Forum Contributor
- Posts: 142
- Joined: Thu Jan 15, 2004 7:34 pm
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
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