Connecting Tech Pros Worldwide Forums | Help | Site Map

php as cgi

Captain Dondo
Guest
 
Posts: n/a
#1: Jan 31 '06
I am trying to use php 4.4.2 as a cgi scripting language. I am running
a self-built linux distribution, with php 4.4.2 compiled from source.
I am using the busybox web server, which doesn't have the ability to
incorporate php as a module.

The problem I am having is that php is insistent about sending

X-Powered-By: PHP/4.4.2
Content-type: text/html

at the start instead of

HTTP/1.0 200 OK
Content-type: text/plain

Any way I can get php to quit doing what it's doing and do what I think
it should be doing?

TIA,

--Yan

Erwin Moller
Guest
 
Posts: n/a
#2: Jan 31 '06

re: php as cgi


Captain Dondo wrote:
[color=blue]
> I am trying to use php 4.4.2 as a cgi scripting language. I am running
> a self-built linux distribution, with php 4.4.2 compiled from source.
> I am using the busybox web server, which doesn't have the ability to
> incorporate php as a module.
>
> The problem I am having is that php is insistent about sending
>
> X-Powered-By: PHP/4.4.2[/color]

Check php.ini. Search for
expose_php = On
[color=blue]
> Content-type: text/html[/color]

Look in php.ini
Search for
default_mimetype = "text/html"

[color=blue]
>
> at the start instead of
>
> HTTP/1.0 200 OK
> Content-type: text/plain
>
> Any way I can get php to quit doing what it's doing and do what I think
> it should be doing?[/color]

Yep. :-)
Change php.ini

You can also use ini_set() to overrule php.ini per script basis.

Regards,
Erwin Moller
[color=blue]
>
> TIA,
>
> --Yan[/color]

Iván Sánchez Ortega
Guest
 
Posts: n/a
#3: Jan 31 '06

re: php as cgi


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Captain Dondo wrote:
[color=blue]
> The problem I am having is that php is insistent about sending
>
> X-Powered-By: PHP/4.4.2
> Content-type: text/html
>
> at the start instead of
>
> HTTP/1.0 200 OK
> Content-type: text/plain
>
> Any way I can get php to quit doing what it's doing and do what I think
> it should be doing?[/color]

Hhhhmmm... Have you tried to... ?

<?php

header('HTTP/1.0 200 OK');
header('Content-type: text/plain');

?>

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
MSN:i_eat_s_p_a_m_for_breakfast@hotmail.com
Jabber:ivansanchez@jabber.org ; ivansanchez@kdetalk.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD30lA3jcQ2mg3Pc8RAvTqAJ96rnWLqW8SThAGRLx/p9WGTtkJSwCbBR6J
0lTiSmzLiRWmVYYL3SKVCfI=
=JOrH
-----END PGP SIGNATURE-----
Marek Simon
Guest
 
Posts: n/a
#4: Jan 31 '06

re: php as cgi


[color=blue]
> Hhhhmmm... Have you tried to... ?
>
> <?php
>
> header('HTTP/1.0 200 OK');
> header('Content-type: text/plain');
>
> ?>[/color]

Header('Content-type: text/plain');
is enough (usualy)
Marek
Tim Roberts
Guest
 
Posts: n/a
#5: Feb 1 '06

re: php as cgi


Captain Dondo <yan@NsOeSiPnAeMr.com> wrote:
?[color=blue]
>I am trying to use php 4.4.2 as a cgi scripting language. I am running
>a self-built linux distribution, with php 4.4.2 compiled from source.
>I am using the busybox web server, which doesn't have the ability to
>incorporate php as a module.
>
>The problem I am having is that php is insistent about sending
>
>X-Powered-By: PHP/4.4.2
>Content-type: text/html
>
>at the start instead of
>
>HTTP/1.0 200 OK
>Content-type: text/plain
>
>Any way I can get php to quit doing what it's doing and do what I think
>it should be doing?[/color]

Unless the script name starts with "nph-", the HTTP/1.0 line is the
responsibility of the web server, not the CGI script. Of course, it's
possible that the busybox web server never does the parsing that it's
supposed to, in which case the 'header("HTTP/1.0 200 OK");' suggestion is
the right one.

The X-Powered-By line doesn't hurt anything. Content-Type does not have to
be first.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Closed Thread