Permalinks error? or...

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 6, 2016   (RSS)

By rez - May 5, 2016

I use the permalinks plug. Each page is working fine except, I noticed today, one page.

If I go to mydomain.com/news

It's fine.

If I go to the actual page

mydomain.com/news.php

I get this:

Couldn't start session! 'session_start(): Cannot send session cache limiter - headers already sent (output started at /home/mydomain/public_html/news.php:3)'!

I deleted the plugin entry for the news page and remade exactly like the others that work but this one still doesn't work.

Any direction? Thanks.

By ross - May 5, 2016

Hi rez

Could you reply a copy of your news.php page as an attachment?  

Important note: I am specifically asking for it as an attachment instead of just copying and pasting the code into a reply.  It's easier for me to read that way.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By rez - May 6, 2016

Page attached. Thanks. :)

Attachments:

news_IT.php 7K

By gregThomas - May 6, 2016

Hey Rez,

I think I've found the issue, on line 2 of the new_IT.php page there is a blank line:

<?php header('Content-type: text/html; charset=utf-8'); ?>

<?php

  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library

  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';

This blank line causes the document to start being sent to the user's browser and headers for the document can no longer be set. But the CMS Builder code base will often need to set headers, which is why this error is being thrown. If you remove this blank line:

<?php header('Content-type: text/html; charset=utf-8'); 

  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/client/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

The issue should be resolved, as headers can be set by the CMS builder code base. 

I noticed that the news_IT.php file has a blank line between each line of content. This normally happens because your local system is using a different newline character to the server, then the FTP client misinterprets the blank lines when the file gets uploaded. You can resolve this issue by changing the transfer type on your FTP client to binary. Here is how to do this with Filezilla:

Transfer (Menu) ->  Transfer Type -> Binary

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com