Many of the interesting techniques I’ve been seeing on other blogs, like AJAX comment submission, and live comment preview, are default features of the new K2 Beta theme. Unfortunately, when I switched to the new template the comment preview didn’t seem to be working. I tried downloading the files again, de-installing, re-installing, but the comment preview still wouldn’t work. I spent a while looking at support blogs, forums, and even the PHP code for the plugins themselves before I realized what was going wrong. I’m hoping that posting a brief explanation of the problem, and how to fix it, will be helpful for anyone else who runs into this issue…

The JavaScript file needed for this feature is being called from a URL like this:

/wp-content/plugins/live-comment-preview.php/commentPreview.js

Notice that while the file ends in .js like a regular JavaScript file, it’s actually the file live-comment-preview.php with the variable /commentPreview.js being passed to it—which results in a dynamically generated JavaScript file being returned to the browser. The problem occurs with the way some Dreamhost sites have their PHP setup. PHP runs as a CGI script, and not an Apache module. While this has a number of advantages, one notable problem is that variables in the URL which are not regular ?foo = bar format won’t work without using mod_rewrite. Instead of having the .js file returned to the browser, a “No input file specified” error is returned instead.

So the solution would appear to be writing some code for your .htaccess file—which some people might find challenging and/or annoying. Fortunately there’s another very easy way to fix this problem!

Steps:

  1. Login to your Dreamhost control panel
  2. Manage the domain your blog is installed on.
  3. Edit your Web Hosting settings and change your PHP version from 4.4.2 to 5.1.2.
  4. Serve delicious live comment previews to your visitors

Why not try give it a try. ;-)

I should also mention – we’re in the midst of a series of updates right now as I move the site from the older template to the newer K2 based template. I had considered doing all the redesign work on another Wordpress installation and only updating this site when everything was finished, but ultimately decided to go with an iterative redesign process that anyone stopping by is welcome to see. If you run into any minor layout or coding issues, please be patient – I’m probably working on the site while you’re visiting!

3 Responses to “Live Comment Preview - Wordpress and Dreamhost”  

  1. Gravatar Icon
    1 morganusvitus

    The site looks great ! Thanks for all your help ( past, present and future !)

  2. Gravatar Icon
    2 tonyN

    Hi

    I have a problem with Live Commnent Preview just as you describe it, but I cannot use the very neat php upgrade solution that you suggest.

    The server I use runs php in CGI mode, so there is no mod-rewrite. You mention using an .htaccess file. I would be very grateful if you could give me some some idea what is required. LCP really is a very nice plugin and I would like to use it if possible.

  1. 1 READER: Design