New Beta Forum - Help us test!

74 posts by 20 authors in: Forums > CMS Builder
Last Post: October 8, 2013   (RSS)

By JLynne77 - February 5, 2013

Great job, guys! I've been away from the forums for quite some time, but I just went through the update and password reset. It was a little worrying at first because I thought my account had been deleted from inactivity! But, everything seems to be working great so far. :) The search function is really great. I've been able to find lots of information over the past few days (now that we have some new CMS Builder sites we're working on) that I've needed.

-----
~Jessica Sullivan, Crystal Realm Designs.

By Dave - February 7, 2013

Hi Djulia, 

Thanks for letting us know about PHP session_start() error.  It looks like it's related to the default setup of PHP on our new server.   I've put in a ticket with our hosting company and plesk to get more details and created a custom folder for php sessions above our /htdocs/ folder (instead of the default shared folder PHP uses)  and set it under: Admin > General > session.save_path

In general we've been seeing a lot of issues with how PHP deals with sessions.  We've stopped using them for CMSB login sessions and may replace them with another solution entirely for future releases.   

Another issue we're seeing is PHP creates a zero byte file in /var/lib/php/session for every page a search engine indexes our site.  Even though there's no session data it's the default behavior of PHP so we've had literally tens of thousands of zero byte files.

We're trying out some code that automatically clears those so if anyone else is having a similar issue let me know and I'll share it with you.

Thanks again for the bug reports, cheers! :)

Dave Edis - Senior Developer

interactivetools.com

By Dave - February 7, 2013

JLynne77, thanks for the post, and glad to hear everything has worked out so far.  Stay tuned for more updates in the coming weeks! :)

Dave Edis - Senior Developer

interactivetools.com

By Djulia - February 7, 2013

Hi Dave,

>Another issue we're seeing is PHP creates a zero byte file
I think that I have a similar problem. Currently, I regularly remove the files on the FTP server.
I also use a custom folder for php sessions.

>We're trying out some code that automatically clears those
Can your code function with the previous versions (2.17)?

Thanks again! :)

Djulia

By Dave - February 8, 2013

Hi Djulia,

Here's some code from 2.51 in /lib/init.php that automatically prevent zero-byte files from being left in the folder:

// Remove 0-byte session files on shutdown - added in v2.xx (not added yet)
// PHP _always_ creates session files, even when the sessions are empty.  This means 10 hits from a search engine spider creates
// ... ten 0-byte session files that won't be removed until after session.gc_maxlifetime is reached.  This can create tens of thousands
// ... of unneeded files.  This function removes zero-byte session files on shutdown by calling session destroy. For session in active
// ... use, unsetting all $_SESSION values will cause the session file to be removed, but the same file will be recreated on next page-view.
// PHP Docs Reference: "A file for each session (regardless of if any data is associated with that session) will be created. This is due to
// ... the fact that a session is opened (a file is created) but no data is even written to that file. Note that this behavior is a
// ... side-effect of the limitations of working with the file system... from: http://php.net/manual/en/session.installation.php
$useThisBetaFeature = false;
if ($useThisBetaFeature) {
  function _remove_empty_session_file() { if (!@$_SESSION && session_id()) { session_destroy(); }} // removes session file
  register_shutdown_function('_remove_empty_session_file'); // remove session file on shutdown
}

To enable this feature in 2.51, just set $useThisBetaFeature = true;

To add it to older versions, just copy these two lines into the init.php file in /lib/init.php

function _remove_empty_session_file() { if (!@$_SESSION && session_id()) { session_destroy(); }}  // removes session file
register_shutdown_function('_remove_empty_session_file'); // remove session file on shutdown

We'll be testing this for 2.52 and will likely leave it turned on for future releases.

And one last thing.  I had literally tens of thousands of zero byte files, so I googled I found some shell commands to remove them all at once from here: http://www.unix.com/shell-programming-scripting/44271-remove-zero-bytes-files-folder.html

Hope that helps, let me know any feedback or comments.  Thanks!

Dave Edis - Senior Developer

interactivetools.com

By Chris - February 14, 2013

RSS Feeds are in!

There's a new link on many forum pages for an RSS feed for the current page. You can get a feed for messages filtered by:

  1. all forums on the site,
  2. just one forum (this will probably be the most popular feature),
  3. a single thread (you can see the link above: "New Beta Forum - Help us test! (rss)"),
  4. or a custom search query.

Here's a link to the RSS feed for the CMS Builder Forum:

http://www.interactivetools.com/forum/forum-topics.php?rss=1&CMS-Builder-791

Please let us know what you think!

All the best,
Chris

By Djulia - February 14, 2013 - edited: February 16, 2013

Hi Dave,

That does not seem to function on our server. The files continues to accumulate.
But, it is perhaps because of an incomprehension of my share or the configuration of the server.

Thanks again!

Djulia

Attachments:

capture3_001.png 58K

By Djulia - February 15, 2013 - edited: February 15, 2013

Hi Chris,

The Attachements function does not function correctly in Preview mode.

The program indicates that the file does not exist (Attachment not found!). The message is then removed if I use the back button of the browser.

Thanks!

Djulia

Attachments:

capture5_001.png 9K

By Dave - February 17, 2013

Hi Djulia, 

In regards to zero-byte session file cleanup: 

That does not seem to function on our server. The files continues to accumulate.
But, it is perhaps because of an incomprehension of my share or the configuration of the server.

It doesn't erase 0 byte files that already exist, it should just prevent new 0 byte files from being created by CMSB that use the new code.  Also, keep in mind that your session folder might be shared by multiple domains.  So the 0 bytes files might be coming from others domains or other non-CMSB scripts on your domain.

Can you try the following test script?

<?php // session_removed_test.php

  error_reporting(E_ALL | E_STRICT);  // display all errors
  ini_set('display_errors', '1');

  // start session
  print "<h1>Session file Removed Test</h1>\n";
  session_start() or die("Couldn't start session! '$php_errormsg'!");
  $_SESSION = array();
  $sessionPath = ini_get('session.save_path'). "/sess_" . session_id();

  //
  if (@$_REQUEST['remove']) {
    print "Automatic Removal - Removing empty session files.<br/>\n";
    print "Check if session file exists here (it should NOT exist): $sessionPath<br/>\n";
    print "then try <a href='?'>default PHP behaviour</a><br/>\n";

    function _remove_empty_session_file() { if (!@$_SESSION && session_id()) { session_destroy(); }}
    register_shutdown_function('_remove_empty_session_file'); // remove session file on shutdown
  }
  else {
    print "Default PHP - Not removing empty session files.<br/>\n";
    print "Check if session file exists here (it should): $sessionPath<br/>\n";
    print "then try <a href='?remove=1'>automatic removal</a><br/>\n";
  }

?>

Or if that doesn't work, email me at dave@interactivetools.com so I can take a look.  I'd like to make sure this works for 2.52.  Thanks!

Dave Edis - Senior Developer

interactivetools.com

By Djulia - February 21, 2013

Hi Dave,

Did you receive my email?

Thanks!

Djulia