By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,446 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,446 IT Pros & Developers. It's quick & easy.

System scripting with PHP

P: n/a
Hello,

I'd like to use PHP as simple, standalone system-scripting engine rather
than HTML generating engine on Web Server.

Executing simple file: HelloWorld.php
========================
<?
echo "Hello world!\r\n";
?>
========================

I get raw output that looks like this:
========================
X-Powered-By: PHP/4.1.2
Content-type: text/html; charset=iso-8859-2

Hello world!

========================

How can I get rid of those X-Powered-By: and Content-type: headers from the
script's output?

--
Maciej "Sasha" Zalewski

GG# 1850769
mail: josif[WYTNIJTO]@klub.chip.pl
z mojego maila usuń cały nawias kwadratowy

Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Suppress header output with the -q option

Try php -q HelloWorld.php or /path/to/your/script/php -q HelloWorld.php

On 9/24/04 3:45 PM, in article 01************************@ssf.swiat_II,
"Maciej Zalewski" <josif[WYTNIJTO]@klub.chip.pl> wrote:
Hello,

I'd like to use PHP as simple, standalone system-scripting engine rather
than HTML generating engine on Web Server.

Executing simple file: HelloWorld.php
========================
<?
echo "Hello world!\r\n";
?>
========================

I get raw output that looks like this:
========================
X-Powered-By: PHP/4.1.2
Content-type: text/html; charset=iso-8859-2

Hello world!

========================

How can I get rid of those X-Powered-By: and Content-type: headers from the
script's output?


Jul 17 '05 #2

P: n/a
Optionally, you could add it to your script . . .
check the path to PHP Could be /usr/local/bin/php

---- Cut -----

#!/usr/local/bin/php -q
<?
echo "Hello world!\r\n";
?>

---- End Cut -----

Then execute: ./HelloWorld.php
On 9/24/04 3:51 PM, in article BD************************@yahoo.com, "Jamie
Davison" <jd**********@yahoo.com> wrote:
Suppress header output with the -q option

Try php -q HelloWorld.php or /path/to/your/script/php -q HelloWorld.php

On 9/24/04 3:45 PM, in article 01************************@ssf.swiat_II,
"Maciej Zalewski" <josif[WYTNIJTO]@klub.chip.pl> wrote:
Hello,

I'd like to use PHP as simple, standalone system-scripting engine rather
than HTML generating engine on Web Server.

Executing simple file: HelloWorld.php
========================
<?
echo "Hello world!\r\n";
?>
========================

I get raw output that looks like this:
========================
X-Powered-By: PHP/4.1.2
Content-type: text/html; charset=iso-8859-2

Hello world!

========================

How can I get rid of those X-Powered-By: and Content-type: headers from the
script's output?


Jul 17 '05 #3

P: n/a

Jamie Davison <jd**********@yahoo.com> napisał(a) w artykule
<BD79F2F3.AE9C%jd**********@yahoo.com>...
Suppress header output with the -q option

Try php -q HelloWorld.php or /path/to/your/script/php -q HelloWorld.php


It works! :)
Thanks a lot.

--
Maciej "Sasha" Zalewski

GG# 1850769
mail: josif[WYTNIJTO]@klub.chip.pl
z mojego maila usuń cały nawias kwadratowy

Jul 17 '05 #4

P: n/a
Jamie Davison <jd**********@yahoo.com> wrote:
Suppress header output with the -q option

Try php -q HelloWorld.php or /path/to/your/script/php -q HelloWorld.php


As written in the php cli online help (php -h), you should use
php -f <file> rather than php -q <file> for command line scripts.
Don't ask me, what the exact difference is, but I'm pretty sure, they
wouldn't offer two different options to archive exactly the same goal.
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #5

P: n/a


The php -f option will parse the input file. Simple server side would just
need the -q option to suppress headers . . .

See http://us2.php.net/features.commandline

-Jamie

On 9/24/04 5:13 PM, in article a0**************@news.dangerouscat.net,
"Simon Stienen" <si***********@news.slashlife.de> wrote:
Jamie Davison <jd**********@yahoo.com> wrote:
Suppress header output with the -q option

Try php -q HelloWorld.php or /path/to/your/script/php -q HelloWorld.php


As written in the php cli online help (php -h), you should use
php -f <file> rather than php -q <file> for command line scripts.
Don't ask me, what the exact difference is, but I'm pretty sure, they
wouldn't offer two different options to archive exactly the same goal.


Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.