Optimise your pair-hosted WordPress site – use php-cgiwrap

Last Updated on 6 October 2009 by gerry

Wordpress 2.8 named after Chet BakerThe developers at WordPress have been quick to build on the redesign of the Dashboard in version 2.7, with optimised performance in 2.8 and slick features for managing your themes and plugins including theme download/preview/activation directly from the Dashboard. Much work has been done on the automatic upgrade of the core software and plugins, so much so that Automatic Upgrade is the recommended upgrade path from version 2.7.x to 2.8.
Ready to tackle those prednisone questions head-on? If you’ve been prescribed prednisone, let’s bust some myths and get the facts straight.

Curious about the ins and outs of prednisone treatment? For anyone wondering about how it works or potential side effects, we’ve got your back.

Upgrade slows to grinding halt
However when I tried the automatic upgrade of this site (my personal blog), which is hosted with pair Networks, it took several hours to complete with no feedback on progress throughout that time, which didn’t look too promising. I decided to be patient and leave it to do its stuff. At the end of the process the updated Dashboard confirmed that it was now using version 2.8, but it was disappointing to see it flagging a suspicion that the upgrade had not fully completed.

FTP-based auto upgrade is the fallback option
Once it had been pointed out that the Automatic Upgrade can be completed in under a minute or so (thanks Leon) I went looking for the cause and solution for this less than perfect situation. It dawned on me that WordPress could only perform a quick update if this could be run directly from the PHP script without recourse to FTP. However on many hosting services including pair Networks, the default Apache setup runs PHP scripts as user nobody, which will not give the required access control for managing an upgrade of the core WordPress files. WordPress apparently detects this issue and offers an automatic FTP-based upgrade as a fallback option. It is easy to see how the FTP-based approach could drag out for hours as there are over 800 individual files to be transferred under the control of the PHP script, not to mention the management of existing files to be deleted or replaced.
Are you feeling constantly tired and struggling to stay alert during the day? Let’s talk about
provigil – a game-changer in the world of wakefulness-promoting medications.

Mahodder provides the answer – use php-cgiwrap on pair hosted WordPress sites
On the WordPress Support Forum I found a thread which specifically tackled the Automatic Upgrade issue on a pair-hosted WordPress site (thanks Mahodder). The solution is to enable the php-cgiwrap facility so the PHP scripts on your pair site (including any WordPress software) can run as your userid/group rather than the nobody/www user/group. This boils down to a two-step process:

  1. copy the php-cgiwrap interpreter to your cgi-bin directory
  2. modify your .htaccess to invoke the php-cgiwrap interpreter for PHP scripts

The full instuctions are given on the support document at pair Networks.

Dealing with the nobody hangover
The good news is that I am now taking advantage of the super-quick super-convenient automatic update facilities in WordPress 2.8 – the bad news is that established sites will have directories such as uploads, which will be owned by nobody and will now be inaccessible and unmanageable by WordPress. Indeed you can’t do much to sort them out via SSH connection to your pair host. I used a quick and dirty perl CGI script to fix such folders, but that’s a story for another day.

8 thoughts on “Optimise your pair-hosted WordPress site – use php-cgiwrap”

  1. Not sure if I fully understand your problem here Gerry. I update all my wordpress blogs automatically via the admin ftp process. It asks for the ftp details on the upgrade screen, I put them in and a few mins later (max) everything is updated. Not sure if all this cgi-wrap stuff is necessary. Have you run it by your host?

    Also, if you want to manually do it via ftp in Filezilla, Dreamweaver or the likes just delete all folders and files except wp-content, .htaccess and wp-config.php and replace with the new versions.

  2. @Leon thanks for that. All I know is that before I enabled cgi-wrap, I was prompted for my FTP credentials and the first update I tried took approximately 5 hours and didn’t finish in a satisfactory state. Since applying cgi-wrap the WordPress admin does NOT need my FTP details to perform automatic updates and the core update takes less than a minute to complete.

    Regarding manual FTP, I did have to do that on two of my sites (using Core FTP) and because of the number of individual files to be uploaded, the process took in the region of 20-30 minutes. Does FileZilla have a special way of uploading zip files and unzipping them on the server?

  3. The manual ftp update does take a while, depending on your broadband speed of course! Not sure about zip files, doubt if this would be a filezilla function. More of a server/wordpress function.

    PS – get the ‘subscribe to comments’ WP plugin!

  4. RE: ‘subscribe to comments’ I had it installed, but it wasn’t working with this theme. Glad to report, though, that upgrading the theme has fixed this incompatibility.

  5. Hi Gerry,

    You said,
    “I used a quick and dirty perl CGI script to fix such folders, but that’s a story for another day.”

    Would you mind sharing this script? I’m hosting with pair.


  6. Hi @STERLING , in what way are you accessing RSS feeds in Chrome? bookmarklet? Extension? I tried the http://www.feeds.ramisp.org/ View RSS Feed bookmarklet and seemed to come up against a problem, though my wordpress RSS feed does pass the validator test at http://feedvalidator.org – I think the RSS Subscription Extension (by Google) – Version: 2.1.1 worked okay for me in terms of showing an RSS button on the address bar and prompting me to subscribe to feed.

    Sorry it’s not an area I know a lot about.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Find me on Mastodon