Content-type header in php missing
I'm trying to use php under Apache 1.3, Slackware 11. Perl/CGI is working fine but when I run a PHP script, I get the 'premature header' error which means neither PHP nor Apache is generating the Content-type header. It works if I put the header line 'Content-type: text/html' right at the top of the PHP script, which is not what I thought I was supposed to do. I've searched php.ini and httpd.conf and Google but I can't find out where the header is supposed to be generated in php.
Where do I configure PHP or Apache to generate the content-type header?
Try adding the following lines above your php entries or creating a header.php file that you include in your code:
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<?php (your code goes here) ?>
The entry to call your header.php every time is:
<?php include ("header.php") ?>
I found the problem! I had ScriptAlias set for the php directory, which tried to execute the php file. I unset ScriptAlias, and it all works fine.
|All times are GMT -5. The time now is 08:00 AM.|