View previous topic :: View next topic |
Author |
Message |
ccs -
Joined: 02 Apr 2005 Posts: 101
|
Posted: Mon Oct 27, 2008 4:36 am Post subject: Does PHP work like SSI |
|
|
After a weekend of banging my head against the wall, I finally figured out that PHP doesn't "directly" support SQLite v3. I really don't want to waste even more time trying to make PHP work when I can accomplish the same thing in 30 minutes using a compiled CGI application.
However, the thing I like about PHP is the easy ability to mix PHP and HTML together. I know I can do basically the same thing with SSI, but I've been told that the overhead with SSI is a real penalty.
So I'm wondering how PHP does it. Does the whole PHP script get read and executed before presenting the HTML like an SSI page would, or does PHP handle that better?
Also, can I assume that the Web server software (Abyss) has to be written in such a way that it "knows" how to handle PHP pages? I beginning to wonder why I can't just write my own "PHP Like" interpreter and mix the code in HTML the same way PHP does. |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Oct 27, 2008 4:18 pm Post subject: Re: Does PHP work like SSI |
|
|
ccs wrote: | After a weekend of banging my head against the wall, I finally figured out that PHP doesn't "directly" support SQLite v3. I really don't want to waste even more time trying to make PHP work when I can accomplish the same thing in 30 minutes using a compiled CGI application. |
PHP 5 comes with SQLite support. Not sure what "directly" means here but you can include SQLite statements in your PHP code without caring about installing extra libraries or extensions.
Quote: | However, the thing I like about PHP is the easy ability to mix PHP and HTML together. I know I can do basically the same thing with SSI, but I've been told that the overhead with SSI is a real penalty. |
PHP and SSI both have an overhead since they need to process your page before generating the output (or while generating the output).
Quote: | So I'm wondering how PHP does it. Does the whole PHP script get read and executed before presenting the HTML like an SSI page would, or does PHP handle that better? |
PHP pushes the generated output as it reads/processed your page. You can enable PHP buffering to have it output the final HTML in a single chunk. But that does not make a big difference in processing time.
Quote: | Also, can I assume that the Web server software (Abyss) has to be written in such a way that it "knows" how to handle PHP pages? I beginning to wonder why I can't just write my own "PHP Like" interpreter and mix the code in HTML the same way PHP does. |
Abyss does not need to know how a particular language works. It dialogs with PHP or any other interpreter using CGI/FASTCGI or ISAPI. These protocols make things more flexible for both sides and avoids software developers the hassle of supporting each language on its own (or vice versa each server on its own).
You can of course write your own interpreter with no problems. Abyss Web Server will pass the "script file" name to it through an environment variable and your interpreter has to output some CGI headers and the final HTML back (by writingf to standard output). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Oct 27, 2008 4:18 pm Post subject: Re: Does PHP work like SSI |
|
|
ccs wrote: | After a weekend of banging my head against the wall, I finally figured out that PHP doesn't "directly" support SQLite v3. I really don't want to waste even more time trying to make PHP work when I can accomplish the same thing in 30 minutes using a compiled CGI application. |
PHP 5 comes with SQLite support. Not sure what "directly" means here but you can include SQLite statements in your PHP code without caring about installing extra libraries or extensions.
Quote: | However, the thing I like about PHP is the easy ability to mix PHP and HTML together. I know I can do basically the same thing with SSI, but I've been told that the overhead with SSI is a real penalty. |
PHP and SSI both have an overhead since they need to process your page before generating the output (or while generating the output).
Quote: | So I'm wondering how PHP does it. Does the whole PHP script get read and executed before presenting the HTML like an SSI page would, or does PHP handle that better? |
PHP pushes the generated output as it reads/processed your page. You can enable PHP buffering to have it output the final HTML in a single chunk. But that does not make a big difference in processing time.
Quote: | Also, can I assume that the Web server software (Abyss) has to be written in such a way that it "knows" how to handle PHP pages? I beginning to wonder why I can't just write my own "PHP Like" interpreter and mix the code in HTML the same way PHP does. |
Abyss does not need to know how a particular language works. It dialogs with PHP or any other interpreter using CGI/FASTCGI or ISAPI. These protocols make things more flexible for both sides and avoids software developers the hassle of supporting each language on its own (or vice versa each server on its own).
You can of course write your own interpreter with no problems. Abyss Web Server will pass the "script file" name to it through an environment variable and your interpreter has to output some CGI headers and the final HTML back (by writingf to standard output). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
ccs -
Joined: 02 Apr 2005 Posts: 101
|
Posted: Mon Oct 27, 2008 5:51 pm Post subject: |
|
|
Quote: | PHP 5 comes with SQLite support. Not sure what "directly" means here but you can include SQLite statements in your PHP code without caring about installing extra libraries or extensions.
|
PHP doesn't support SQLite Version 3 directly. Yes, you can still use it, but you need to use PDO. I spent hours trying to debug SQLite code that should have worked only to find out later that native PHP 5 was looking at my database as version 2.
So if I were to write my own interpreter, would I simply give the script files a different extension and the configure the CGI settings in Abyss like I do for PHP, PERL, etc? That would be way cool. :) |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Tue Oct 28, 2008 4:07 pm Post subject: |
|
|
ccs wrote: | PHP doesn't support SQLite Version 3 directly. Yes, you can still use it, but you need to use PDO. I spent hours trying to debug SQLite code that should have worked only to find out later that native PHP 5 was looking at my database as version 2. |
Thank you for sharing that with us. We were not aware of the lack of direct SQLite 3 support.
Quote: | So if I were to write my own interpreter, would I simply give the script files a different extension and the configure the CGI settings in Abyss like I do for PHP, PERL, etc? That would be way cool. :) |
Yes. That's all you have to do. You can even write simple pre-processors (not full interpreters) to format some files. For example, you can associate .csv files with a program of your own which will read csv files and output formatted tables. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
ccs -
Joined: 02 Apr 2005 Posts: 101
|
Posted: Tue Oct 28, 2008 4:23 pm Post subject: |
|
|
Great! Thanks for the help.
I think I have my own SQLite3 interpreter working pretty well now :) |
|
Back to top |
|
|
|