I have a dynamic CSS (with some values and class/id names provided by php). the file begins with:
header("Content-type: text/css; charset: UTF-8");
require("../../_Config/config.php");
The directory structure is (to determine the relative position of config.php
and css.php
files):
ROOT
-[_Config]
-config.php
-[_Viewer]
-[css]
-css.php
I have Linux Mint 15 installed, with apache and (some) mods enabled - I noticed that headers
mod wasn't enabled... and I enabled it, but that didn't helped. I get the css file in client, but is plain and empty. Strange fact is that under Windows XAMPP it works fine.
Any suggestions here? Maybe the relative path is faulty? I tried several combinations, but neither worked (as I have to go up in the parent, to access config.php
i thought it may be part of the problem).
I'm just accommodating with linux, so it's possible that solution to be very simple... or not. Anyway, if you need more details that i may have skipped here, please ask.
EDIT:
Just a thought: could be a Linux permissions issue? - if so, what would be the suggested workarounds, considering that my site is located in /var/www/
and php is running under www-data
user at this moment. Is it wise to chanve apache ownership?
EDIT 2
Checked header requests in Firebug - this one is for my file
Connection close Content-Encoding gzip Content-Length 20 Content-Type text/css; charset: UTF-8 Date Thu, 03 Oct 2013 15:04:54 GMT Server Apache/2.2.22 (Ubuntu) Vary Accept-Encoding X-Powered-By PHP/5.4.9-4ubuntu2.3 Request Headersview source Accept text/css,*/*;q=0.1 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Connection keep-alive Cookie PHPSESSID=3ohou7v772o20i72rli3iofdq6 Host 192.168.1.99 Referer http://192.168.1.99/index.php User-Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0
This can be happened due to cache problems with vagrant, vm and linux. you can add the request parameter in the url
example
<link src="http://www.example.com/abc.php?v=1.0" > instead of <link src="http://www.example.com/abc.php" >.
Solved!
It seems that the require
statement was evil. Can't explain why (and, if somebody CAN, please post the answer).
What I did, was to replace require
with include
... now I won't get any fatal error in case something goes wrong, but at least the css is loaded properly.