LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 03-11-2007, 05:33 PM   #1
xlq
Member
 
Registered: Feb 2007
Distribution: Slackware 12.0
Posts: 58

Rep: Reputation: 15
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?
 
Old 03-14-2007, 01:36 AM   #2
rch1231
Member
 
Registered: Mar 2007
Location: Bedford, Texas
Posts: 31

Rep: Reputation: 15
Try adding the following lines above your php entries or creating a header.php file that you include in your code:

<html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
</head>
<body>

<?php (your code goes here) ?>

The entry to call your header.php every time is:

<?php include ("header.php") ?>
 
Old 03-15-2007, 09:06 AM   #3
xlq
Member
 
Registered: Feb 2007
Distribution: Slackware 12.0
Posts: 58

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to forward packets based on HTTP header content? varange Linux - Networking 4 11-24-2006 03:39 PM
php & imap: where's the Content-type of one attachment? eantoranz Programming 1 05-26-2006 11:37 AM
content-length HTTP header MPowers Linux - Software 0 04-07-2006 04:01 PM
use CGI vs. content-type: text/html johnensd Red Hat 0 05-10-2004 12:55 AM
Content-Type: multipart/appledouble - Mail Problem WeNdeL Linux - Software 1 09-02-2003 03:04 PM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration