PHP with Apache-CGIs

PHP with Apache-CGIs

Post by Daniel Schneide » Sat, 04 Sep 1999 04:00:00



Hi everyone,

I want to do the following:

I have some CGI (eCommerce-System) which generate a output to the User.
The CGIs open a HTML-template and parse it. so far - so good.

now I want to include PHP in that HTML-Template. But the PHP-statements
dont get evaluated. I am not suer how to solve this problem: do I need
to tell the apache that he should evaluate php in CGI output? or is this
a php-problem?

any help is welcome.
--
Daniel Schneider

 
 
 

PHP with Apache-CGIs

Post by Rasmus Lerdo » Sat, 04 Sep 1999 04:00:00



>Hi everyone,

>I want to do the following:

>I have some CGI (eCommerce-System) which generate a output to the User.
>The CGIs open a HTML-template and parse it. so far - so good.

>now I want to include PHP in that HTML-Template. But the PHP-statements
>dont get evaluated. I am not suer how to solve this problem: do I need
>to tell the apache that he should evaluate php in CGI output? or is this
>a php-problem?

This can't really be described as a PHP problem.  You could perhaps call
it an Apache architecture problem if you wanted to be *.  

The problem is that Apache does not support stacked content handlers,
or any stacked IO for that matter.  This means that you cannot take the
output from a module like mod_cgi that handles CGIs and feed it to the
mod_php module which does the PHP parsing.  Stacked IO may make an
appearance at some point in the Apache 2.x cycle.  Probably not 2.0
though.

In the meantime, your best bet is probably to call your CGI from with
a PHP page using the virtual() function which make an Apache sub-request.
You are not going to be able to mix PHP tags into your cgi output
this way either, but you can at least have PHP stuff happening before
and after the virtual() call which might serve your needs.

Another alternative is of course to port these CGIs to PHP which would
solve all your problems.

-Rasmus

 
 
 

PHP with Apache-CGIs

Post by Martin Sting » Sat, 04 Sep 1999 04:00:00


Daniel Schneider schrieb:
Quote:

> Hi everyone,

> I want to do the following:

> I have some CGI (eCommerce-System) which generate a output to the User.
> The CGIs open a HTML-template and parse it. so far - so good.

> now I want to include PHP in that HTML-Template. But the PHP-statements
> dont get evaluated. I am not suer how to solve this problem: do I need
> to tell the apache that he should evaluate php in CGI output? or is this
> a php-problem?

[...]

No, that's not a php-problem.
I think it's an apache (1.x.y) problem. It's not possible to read the
output
of one handler (cgi-handler) by another handler (php-handler).

The next apache-version (2.x) will have handler-chaining.

Bye,
Martin Stingl

--
Webmaster -- Verlagsgruppe Deutscher Fachverlag

URLs: http://www.dfv.de, http://www.horizont.net,
http://www.web-worker.de
http://www.twnetwork.de, http://www.lz-net.de,     http://www.agroOnline.de

 
 
 

1. Apache w/ PHP and SSL: w/ PHP OK - w/out PHP NOK

Hi,

        I've been assigned the task of building an Apache server with
support for Sybase, PHP4, OpenSSL 0.9.6/mod_ssl ?, and apache 1.3.14.

I followed Israel Denis Jr/Eugene Otto's "The Soothingly Seamless
Setup of Apache, SSL, MySQL, and PHP" at DevShed, but compilation of
apache fails if I add PHP.  The same procedure w/out PHP works OK
(either port 80 or port 443.) As a non-developper, I'm totally in the
dark.

[/home/samba/temp/Apache/apache_1.3.14]# SSL_BASE=../openssl-0.9.6
/configure --enable-module=ssl
--activate-module=src/modules/php4/libphp4.a --enable-module=php4
--prefix=/usr/local/apache

Configuring for Apache, Version 1.3.14
(snip)
-L/home/samba/temp/Apache/openssl-0.9.6  -o helpers/dummy
helpers/dummy.c   -rdynamic -Lmodules/php4 -L../modules/php4
-L../../modules/php4 -lmodphp4  -lpam  -ldl -lresolv -lm -ldl -lcrypt
-lnsl  -lresolv   -lm -lcrypt  -lssl -lcrypto
/usr/bin/ld: cannot find -lmodphp4
collect2: ld returned 1 exit status
make: *** [dummy] Error 1

Any idea?

Thx
FF.

2. 3com905c-TX and Telocity DSL gateway

3. Apache Rewrite domain.com->index.php domain.org->index2.php

4. pidentd-2.7b1 & NetBSD 1.1A

5. Solaris - PHP- Apache- Oracle : Problem getting PHP installed

6. Need some ftp stat software

7. Apache 1.3.3 CGIs and escaped '/'

8. Building FVWM 2.0...

9. dns, apache, cgis samples

10. Apache stops executing CGIs

11. Apache and strange behaviour with CGIs

12. Can Apache call suEXEC for all CGIs?

13. CGIs written for NCSA breaking in Apache