faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

27 of 55 people (49%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

SSI document using <--#exec cgi="/file.php"--> it always says "X-Powered-By: PHP/4.0.1pl2 Content-type: text/html" above the output... don't want it

Jun 8th, 2008 20:05
forum net tr, Matt Gregory, Tom Hoffmann, http://www.firmanettr.com/


You are getting this response because PHP is designed to behave as 
though being called by a web-server.  When you call it from another 
application/script/function then you need to be careful not to embed 
any HTML or return any HTML with anything other than the print("") 
function.  The reason is because PHP will automatically prepend the 
content type information to html (This is the same problem you would 
have if you were trying to return an image from a php script, you would 
have to use the header function).
If you return only data or plain test, you can use the header funtion 
to return an empty string and get simlar results to what you want.  I 
would recommend Python or Perl to do what you are attempting, not PHP.  
PHP is built for HTML and Web scripting, not in-line process scripting.
http://www.firmanettr.com/