Forum
"session_start()" warning when using perch_template() with content containing as...
I'm getting the following error when using perch_template() to process some text-based content containing a [cms:asset 9999] shortcode. The problem does not occur if the content does not contain a shortcode.
Warning: session_start(): Cannot send session cache limiter - headers already sent in C:\xampp\htdocs\miraviva\perch\core\lib\PerchSession.class.php on line 27
Here's the line that creates the problem:
$country_body = perch_template('content/textile.html', array( 'text' => $country['country_body'] ), true);
The template it's referring to is a very simple one:
<perch:content id="text" type="textarea" label="Text" textile="true" />
Any ideas?
Diagnostics:
Perch: 3.0.11, PHP: 5.6.30, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_blog (5.6.1), perch_forms (1.10), perch_gallery (2.8.9)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_gallery', 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: C:\xampp\htdocs\miraviva\perch
PERCH_CORE: C:\xampp\htdocs\miraviva\perch\core
PERCH_RESFILEPATH: C:\xampp\htdocs\miraviva\perch\resources
Image manipulation: GD
PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: miraviva
DOCUMENT_ROOT: C:/xampp/htdocs/miraviva
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
What happens before the problematic line?
In short - a lot. There's plenty output to the screen before this occurs.
I should have mentioned - I'm in the process of migrating a long-lived Perch v2 site to Perch v3. The problem didn't occur in Perch v2.
Thanks for your assistance, Drew.
As a workaround, I've moved the problematic line to the top of the page (before the headers are sent) and it works fine, as it should.
Just a little difference between Perch v2 and v3, I guess.
Thanks for your help.