Link to home
Start Free TrialLog in
Avatar of technoparkcorp
technoparkcorpFlag for United States of America

asked on

can I suppress headers in PHP/CLI?

I have Zend Framework-based web site. When I start application from Cron I always get this output. How can I suppress such PHP headers in Zend? Or maybe it's a global PHP option?
X-Powered-By: PHP/5.2.9
Set-Cookie: PHPSESSID=a6f12eabbe240c78b7381418b4d21ce3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html

Open in new window

Avatar of shobinsun
shobinsun
Flag of India image

Hi,

try with this:

expose_php = Off in php.ini file.

#!/usr/local/bin/php -q
 
<?
 
...
 
?>

Open in new window

Avatar of technoparkcorp

ASKER

I tried both options, no effect :(
Avatar of dazweeja
dazweeja

I think the -q option is what you need (as aldanch has written). Maybe the path is wrong for your installation?

Try this from a shell/command prompt:

php -q test.php
this is what I get when I use -q
<br />
<b>Fatal error</b>:  Uncaught exception 'Zend_Session_Exception' with message 'Session must be started before any output has been sent to the browser; output started in /0' in /home/xxx/library/Zend/Session.php:419
Stack trace:
#0 /home/xxx/application/bootstrap.php(92): Zend_Session::start()
#1 /home/xxx/application/Robot/run.php(22): require('/home/xxx...')
#2 {main}
  thrown in <b>/home/xxx/library/Zend/Session.php</b> on line <b>419</b><br />

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dazweeja
dazweeja

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's always "cli", in my case it's "cgi-fcgi". Anyway it works now, thanks!
Thanks for the points. I assumed from your use of Zend_Session that this code must also be intended to be run in a browser.