在Apache 2.x中结合SSI,PHP和CGI [英] Combining SSI, PHP, and CGI in Apache 2.x

查看:50
本文介绍了在Apache 2.x中结合SSI,PHP和CGI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Apache 2.x中结合SSI,CGI和PHP?我一直在阅读

这可以做到,但我没有找到任何实际需要的实际

配置的例子。

我想做的是:


1.从文件中提取页面或使用CGI程序生成页面

(取决于像往常一样在各个URL上。


2.通过include模块运行上面(1)的输出,以便扩展SSI

调用。


3.通过PHP运行上面(2)的输出,以便扩展和执行任何PHP代码(包括文件中包含的任何PHP代码)

来自上一步的SSI)。


我想为每一页都这样做。


我我认为Apache 2.0可以做到这一点。那怎么回事?
怎么办?


-

在我的电子邮件地址中移植hotmail和mxsmanic直接联系我。

How can I combine SSI, CGI, and PHP in Apache 2.x? I keep reading that
this can be done, but I haven''t found any examples of the actual
configuration required to do it.

What I want to do is:

1. Either pull the page from a file or generate it with a CGI program
(depending on the individual URL, as usual).

2. Run the output from (1) above through the includes module so that SSI
calls are expanded.

3. Run the output from (2) above through PHP so that any PHP code is
expanded and executed (including any PHP code in files included by the
SSI from the previous step).

I want to do this for every page.

I''m under the impression that Apache 2.0 can do this. So how is it
done?

--
Transpose hotmail and mxsmanic in my e-mail address to reach me directly.

推荐答案

2005年1月15日星期六01:37:19 +0100,Mxsmanic< mx ****** @ hotmail.com> ;

虔诚地吟唱在以太:
On Sat, 15 Jan 2005 01:37:19 +0100, Mxsmanic <mx******@hotmail.com>
reverently intoned upon the aether:
如何在Apache 2.x中结合SSI,CGI和PHP?我一直在阅读
这可以做到,但我没有找到任何实际配置所需的配置。

我想要做的是:

1.从文件中提取页面或使用CGI程序生成页面
(视通常的个人URL而定)。

2.运行上面(1)的输出通过包含模块,以便扩展SSI
调用。


为什么在PHP代码中使用include(),require(),

include_once()和require_once()时可以使用SSI。这将使

创建一个更加动态的包含结构,而不是使用

SSI。更好的是,一个包含的文件可以调用include(),所以你有一个

递归,这在我最后一次检查时在SSI中不起作用。


简而言之, PHP有一个比SSI更强大的包含结构,所以

为什么还要花费额外的步骤。

3.通过PHP运行上面(2)的输出所以任何PHP代码都被扩展和执行(包括上一步中SSI包含的文件中的任何PHP代码)。

我想为每个页面执行此操作。

我的印象是Apache 2.0可以做到这一点。那么它是如何完成的?
How can I combine SSI, CGI, and PHP in Apache 2.x? I keep reading that
this can be done, but I haven''t found any examples of the actual
configuration required to do it.

What I want to do is:

1. Either pull the page from a file or generate it with a CGI program
(depending on the individual URL, as usual).

2. Run the output from (1) above through the includes module so that SSI
calls are expanded.
Why use SSI when you can simply use include(), require(),
include_once(), and require_once() within PHP code. This will let
create a far more dynamic include structure than you will get using
SSI. Even better, an included file can call include() so you have
recursion which did not work in SSI the last time I checked.

In short, PHP has a more powerful include structure than SSI gives, so
why bother with the extra step at all.

3. Run the output from (2) above through PHP so that any PHP code is
expanded and executed (including any PHP code in files included by the
SSI from the previous step).

I want to do this for every page.

I''m under the impression that Apache 2.0 can do this. So how is it
done?




至于你的一般问题,根据用户输入运行CGI程序

然后让它将用户重定向到PHP脚本。怎么这个

完成了?好吧,这取决于您编写cgi代码的语言

in。


除非您使用预编码的cgi例程或需要特定于cgi的

工具,为什么不只是使用PHP来做整件事?


享受,


Sean



在最后,我们将不记得敌人的话,

但我们朋友的沉默。


- 小马丁路德金(1929-1968)


照片档案@ http://www.tearnet.com/Sean

最后更新于2004年9月29日



As for your general question, run the CGI program based on user input
and then have it redirect the user to the PHP script. How is this
done? Well, it depends on the language you are writing the cgi code
in.

And unless you are using a precoded cgi routine or need a cgi specific
tool, then why not just use PHP for the whole thing?

enjoy,

Sean


"In the End, we will remember not the words of our enemies,
but the silence of our friends."

- Martin Luther King Jr. (1929-1968)

Photo Archive @ http://www.tearnet.com/Sean
Last Updated 29 Sept. 2004


Sean写道:

[snip]
Sean wrote:
[snip]
SSI。更好的是,一个包含的文件可以调用include(),所以你有一个递归,这在我最后一次检查时在SSI中不起作用。
SSI. Even better, an included file can call include() so you have
recursion which did not work in SSI the last time I checked.




一个包含的文件能够包含另一个文件不是

递归的一个例子,它是一个嵌套的例子。递归是

函数调用自身的能力。包含其自身的文件仅在

a非常一般意义上是递归的,并且不会产生有意义的结果。


NM


-

将大写单词转换成单击键回复



An included file being able to include another file is not an example of
recursion, it is an example of nesting. Recursion is the capability of
a function to call itself. A file including itself is recursive only in
a very general sense and it would not produce a meaningful outcome.

NM

--
convert uppercase WORDS to single keystrokes to reply


Sean写道:
Sean writes:
为什么在PHP代码中只使用include(),require(),
include_once()和require_once()时使用SSI。这将使
创建一个比使用
SSI更加动态的包含结构。更好的是,一个包含的文件可以调用include(),所以你有一个递归,这在我最后一次检查时在SSI中不起作用。

简而言之,PHP有一个比SSI给出了,所以
为什么要费心去做额外的一步。


简而言之,你对我的问题没有答案。也许别人

会。

至于你的一般问题,根据用户输入运行CGI程序
然后让它将用户重定向到PHP脚本。这是怎么做的?好吧,这取决于你编写cgi代码的语言
in。


我不在乎它是怎么做的,因为那不是我想做的事。我希望Perl CGI程序生成输出,然后由

mod_include解析,然后由PHP处理。

除非你是使用预编译的cgi例程或需要一个特定的cgi工具,为什么不只是使用PHP来完成整个事情?
Why use SSI when you can simply use include(), require(),
include_once(), and require_once() within PHP code. This will let
create a far more dynamic include structure than you will get using
SSI. Even better, an included file can call include() so you have
recursion which did not work in SSI the last time I checked.

In short, PHP has a more powerful include structure than SSI gives, so
why bother with the extra step at all.
In short, you don''t have an answer for my question. Maybe someone else
will.
As for your general question, run the CGI program based on user input
and then have it redirect the user to the PHP script. How is this
done? Well, it depends on the language you are writing the cgi code
in.
I don''t care how it''s done, because that''s not what I want to do. I
want the Perl CGI program to generate output that is then parsed by
mod_include, and then processed by PHP.
And unless you are using a precoded cgi routine or need a cgi specific
tool, then why not just use PHP for the whole thing?




这不是一个类项目,它是一个拥有数千个

文件的生产网站,必须保持连贯,一致和可维护。


我仍​​然需要回答我的问题。


-

在我的电子邮件地址中移植hotmail和mxsmanic直接联系我。



This isn''t a class project, it''s a production site with thousands of
files that must remain coherent, consistent, and maintainable.

I still need an answer to my question.

--
Transpose hotmail and mxsmanic in my e-mail address to reach me directly.


这篇关于在Apache 2.x中结合SSI,PHP和CGI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆