I have some issues with a PHP file that is not working properly. The Content-type does not get recieved by any browser at all. Firebug interprets the file as text/html inste
This sounds like your webserver is interpreting the script as a normal file. Does it have a .php extension and do other .php files work as expected?
It may be worth checking with curl to see what headers are actually being sent.
Try this from a command line and check for the "text/css":
curl -I http://example.com
Depending on the browser's request headers, PHP could also be sending the output gzipped using output buffering. In the PHP file, try this to check for ob_gzhandler
.
print_r(ob_list_handlers());
If it's enabled, check in for zlib.output_compression
in your php.ini or Apache configuration.
I found the full file is indented.
<?php
header('Content-Type: text/css; charset=UTF-8');
echo 'body {background-color: #000000; }';
?>
Because the indentation on line 1 outputted 4 spaces, therefore, the header will not work.
You can try Content-Style-Type: text/css
See the below from the here
<META http-equiv="Content-Style-Type" content="text/css">
The default style sheet language may also be set with HTTP headers. The above META declaration is equivalent to the HTTP header:
Content-Style-Type: text/css
Edit:
At the link , it's mentionned to add AddType text/css .css
in the apache config file.
Maybe you can give it a try
Edit2 Look up for 'css' at this link. Someone had the same problem as you. Try sending the header without the charset
I recently had a hair-threatening problem with Firefox and XHTML 1.0 transitional.
It worked fine with other browsers, and also with HTML 4.1.
To cut a long story short, PHP-generated JS and CSS files were still being reported by the headers as text/html, while in the HTML they were text/css and application/javascript; Firefox having been told the page was XHTML 1.0 became anal-retentive and refused to style the page. (I think the JS still worked but I fixed it anyway.)
Solution:
header('Content-type: text/css'); and header('Content-type: application/javascript');
Edit 3 There was a post about some forms not submitting any data because of an utility called AVG Linkscanner. Since you have reinstalled Apache + php and I assume you didn't reinstall the OS, so you can maybe investigate on this/try by turning some utilities/plugs-ins off.
output_buffering = Off
in php.ini was the reason for me why it keeps sending Content-Type = text/html
. Setting it to 1 solves it.
Maybe the function header()
is disabled in your configuration?
Test:
print ini_get('disable_functions');