Hi, I am trying to set up a generic system on my Apache/PHP system. After setting up aliases and using the "virtual" function in PHP I half accomplished what I was trying to achieve. I am having troubles with the "header" command however. For example... global.php <?php session_start(); header("Cache-control: private); ?> PHP: (May not be axactly right as I am trying to remember with out seeing the file, but it is correct in the file) index.php <?php virtual("/conf/global.php"); ?> PHP: This will result in the error "headers already sent". However, if I do the following... index.php <?php include 'path/to/global.php'; ?> PHP: It will work. Are there any known problems trying to set headers while using the "virtual" function?
you can edit the php.ini file to turn on output buffering: http://no2.php.net/ob_start That should fix those problems
Ok, I'll look into that when I get back to my work. Will it make any changes to my current code or are there any performance issues with using this?
Also, this: <?php session_start(); header("Cache-control: private); ?> Needs to be this: <?php session_start(); header("Cache-control: private"); ?>
I did say in the first post underneath that snippet it may be wrong but is correct in the file, I was typing that in quickly and forgot the last speech mark.
As for performance issues, you shouldn't encounter any, unless you are running an extremely high traffic site - but then you'd probably do some other measures anyway. The existing code should not be affected by this, no.
Hmm, I've turned output_buffering on in my php.ini file and tried using ob_start() but still having the same problem with headers being outputted. Any ideas?