Upgrading SMF from Version 1.1.11 to 1.11.12

To patch the Simple Machines Forum (SMF) software, i.e., to install a minor rather than major update, such as from version 1.1.11 to 1.1.12, take the following steps:
  1. Log into the forum using an administrator account.
  2. Click on Admin.
  3. Click on Packages.
  4. Under Latest Packages, you should see something like "You can install this patch (click here to install) to update your version". Click on the link provided, which will take you to a FTP Information Required page.
  5. Provide the username, password, and path to the SMF files on the FTP server and then click on Proceed.
  6. You should then see an Install Actions page showing the actions to be performed for the upgrade. Click on Install Now.
  7. You should then see the message "The package was installed successfully. You should now be able to use whatever functionality it adds or changes; or not be able to use functionality it removes." If you click on your browser's refresh button, you should see the new version of SMF listed at the bottom of the window, if your forum displays the version at the bottom of webpages for the forum.

For one forum, when I was updating to a newer version, I saw the following at the FTP Information Required page:

Some of the files the package manager needs to modify are not writable. This needs to be changed by logging into FTP and using it to chmod or create the files and folders. Your FTP information may be temporarily cached for proper operation of the package manager.

When I provided the FTP login information, though, and then chose Install Now, the update was applied. However, on another system, when I refreshed the page, I still saw the old SMF version, even though I had seen the message "The package was installed successfully. You should now be able to use whatever functionality it adds or changes; or not be able to use functionality it removes.. I went through the steps again and saw an error message:

An Error Has Occurred!

You cannot download or install new packages because the Packages directory or one of the files in it are not writable!

I checked the SMF error log, which you can view through the administrator interface to the SMF software by taking the following steps:

  1. Log into the forum using an administrator account.
  2. Click on Admin.
  3. Under Maintenance on the left side of the page, click on Forum Error Log.

I navigated through the log to find the entries starting at the time I attempted to upgrade the software. Note: you can change the "start=number" parameter at the end of the URL in your browser's address field for error log entries to be an arbitrary number you pick to avoid manually moving back through lots of pages, e.g., "start=1635".

The first entry I found in the error log for the install attempt referenced "failed to open stream: Permission denied" for Subs-Package.php in the forum/Sources directory.

I noticed that on the forum where the upgrade had been successful that the permissions on the Sources directory, i.e., 775, but the permissions on the file Subs-Package.php differed.

$ ls -ld Sources
drwxrwxr-x 2 jdoe jdoe 4096 Jul 18 20:39 Sources
$ ls -l Sources/Subs-Package.php
-rw-r--r-- 1 jdoe jdoe 93120 Apr 30  2008 Subs-Package.php

I changed the permissions with chmod 777 Sources/Subs-Package to match the system on which I had been able to successfully complete the upgrade. When I tried reinstalling again, the results were the same, however.

And I found, when I checked the permissions for yet another forum on a hosting provider where the file permissions for Subs-Package.php were 666 that I was able to successfully upgrade the software on that system.

Looking for other differences, I found that, when I looked at the downloaded file on the system where the upgrade failed, that there were several copies of the downloaded upgrade file, corresponding to the various upgrade attempts and that they had the user and group of apache rather than the user's userid. For the two forums where the upgrade succeeded, the downloaded file had the same ownership as the other files in the directory, i.e., the userid for the user. I deleted all of the prior downloaded .gz files for the upgrade.

[jdoe@example forum]$ cd Packages
[jdoe@example Packages]$ ls -l
total 60
-rwxrwxrwx 1 apache apache 18904 Jul 20 20:50 1.6c_new_prof_upgrade.zip
drwxrwxr-x 2 jdoe    jdoe     4096 Jul 18 20:39 backups
-rw-r--r-- 1 jdoe    jdoe      324 Dec 31  2005 index.php
-rwxrwxrwx 1 jdoe    jdoe      254 Jan 15 13:34 installed.list
-rw-rw-rw- 1 apache apache  4178 Jan 15 12:43 smf_patch_1.0.20_1.1.12_1.tar.gz
-rw-rw-rw- 1 apache apache  4178 Jan 15 13:32 smf_patch_1.0.20_1.1.12_2.tar.gz
-rw-rw-rw- 1 apache apache  4178 Jan 15 12:30 smf_patch_1.0.20_1.1.12.tar.gz
-rwxrwxrwx 1 apache apache  1768 Sep  3 22:00 WOW_Names.zip
[jdoe@example Packages]$ rm *.gz

I clicked on click here to install which resulted in the smf_patch_1.0.20_1.1.12.tar.gz file being placed in the directory. Again it had apache listed as the owner and group.

[jdoe@example Packages]$ ls -l *.gz
-rw-rw-rw- 1 apache apache 4178 Jan 15 14:48 smf_patch_1.0.20_1.1.12.tar.gz

I logged into the root account and changed the owner and group to be the user's userid.

[root@example Packages]# chown jdoe smf_patch_1.0.20_1.1.12.tar.gz 
[root@example Packages]# chgrp jdoe smf_patch_1.0.20_1.1.12.tar.gz

I was at the webpage where I was prompted for the FTP login information, so I provided those and clicked on Proceed. Again, when I installed the upgrade and checked the version, the old version was still listed at the bottom of the forum webpages. But when I looked at the installed packages under Admin for the forum, I saw the new version listed as an installed package.

 Mod Name Version  
1.New Profile Layout | S-Ace 1.6 [ Uninstall ]
2.WOW Names 1.0.0 [ Uninstall ]
3.SMF 1.0.20 / 1.1.12 Update 1.0 [ Uninstall ]

But, if I chose Browse Packages and looked under Modification Packages, I didn't see an "Uninstall" option for the upgrade package, though I did for other installed packages.

The two forums where I had been able to successfully upgade SMF to version 1.11.12 had a default theme, the one where I had been unsuccessful had a different theme. The user thought that might be the cause of the problem, so she changed the theme to the default theme. I then deleted the downloaded upgrade file and tried again, but then saw the error message below:

You cannot download or install new packages because the Packages directory or one of the files in it are not writable!

I noticed that the Packages/backups directory for the forum where I got that message was 775 whereas for one where I had successfully upgraded it was 777, so I changed the 775 one to 777. When I then tried again, I saw the message "This package is already installed, and no upgrade was found!" I was able to click on the Install Now button, though, to proceed. But the version still showed as 1.1.11 when I refreshed the page, even though the "extracting package" message was "The package was installed successfully. You should now be able to use whatever functionality it adds or changes; or not be able to use functionality it removes.

I clicked on the Installed Packages tab and chose "Uninstall", but then got a message about the packages directory or a file in it not being writable again.

An Error Has Occurred!

You cannot download or install new packages because the Packages directory or one of the files in it are not writable!

And the update was showing up twice when I chose to "Browse Packages". I chose "delete" there to get rid of both instances of it.

When I tried again, the file was downloaded into the Packages directory, but I got the "You cannot download or install new packages because the Packages directory or one of the files in it are not writable!" message again.

I tried creating a temp directory under the Packages directory and setting the permissions on it to 777, as I found suggested at "Packages directory or one of the files in it are not writable!", but that didn't help either.

I then tried another option for installing the upgrade. I went to the SMF website and downloaded the "large upgrade" version of smf_1-1-12_install.tar.gz. That one had the note "Using modifications, or not using SMF 1.1.11? No problem, this is what you need." associated with it.

Then under the Admin option on the forum, I chose "Upload a Package" and browsed to where I downloaded the above file, which I tried to upload. But I got the message "The package you tried to upload either is not a valid package or has become corrupted."

I noticed that the temp directory I had created earlier in the Packages directory had been deleted, so I recreated it and changed the permissions on it to 777 again. But that didn't help. I still got the "The package you tried to upload either is not a valid package or has become corrupted." message.

So I then tried the "small update" file, smf_1-1-12_update.tar.gz from the SMF website. I still got the "The package you tried to upload either is not a valid package or has become corrupted" message.

I also tried the zip file for the small update and the one for the large upgrade instead of the tar.gz files, but the results were the same.

I checked the error log again. I saw entries such as the following:

Apply Filter: Only show the errors with the same message 2: file_get_contents(/home/jdoe/forum/Packages/temp/./smf_1-1-11_to_1-1-12_patch.mod) [function.file-get-contents]: failed to open stream: No such file or directory File: /home/jdoe/forum/Sources/Packages.php

I tried to install the file again. I created the forum/Packages/temp directory again and changed the permissions on it to 777. But when I got to the step where I could click on Install Now, before clicking on the Install Now button, I checked the contents of the temp directory.

[jdoe@example Packages]$ ls -l temp
total 28
-rw-rw-rw- 1 apache apache    60 Jan 15 18:15 $auto_0.txt
-rw-rw-rw- 1 apache apache  1743 Jan 15 18:15 package-info.xml
-rw-rw-rw- 1 apache apache  2562 Jan 15 18:15 smf_1-0-19_to_1-0-20_patch.mod
-rw-rw-rw- 1 apache apache 16238 Jan 15 18:15 smf_1-1-11_to_1-1-12_patch.mod

After clicking on the Install Now button and after I got the "The package was installed successfully. You should now be able to use whatever functionality it adds or changes; or not be able to use functionality it removes", the files were still in the temp directory.

At Update 1.1.12 Packages question, I read that neither the small update nor the large upgrade will work through the package manager, though.

So I deleted the .tar.gz file in the Packages directory and all the files in the temp directory beneath it. I then placed the smf_1-1-12_upgrade.tar.gz in the directory where the forum software is stored on the server. I then unzipped and untarred it with tar -zxvf smf_1-1-12_upgrade.tar.gz. I then pointed a browser to the upgrade.php file on the forum website, e.g., http://example.com/forum/upgrade.php. I checked the two options below:

Backup tables in your database with the prefix "backup_example_".
Put the forum into maintenance mode during upgrade.

I then clicked on continue. The upgrade completed successfully and I could now see 1.1.12 listed as the version number at the bottom of forum webpages. I deleted upgrade.php.

Additional Notes:

  1. Readme file for the SMF 1.1.12 large upgrade file.
  2. On Jaunary 16, 2011, I was finally able to determine how to correct the underlying problem that was preventing me from installing modules - see SMF Packages Not Installing

References:

  1. How do I use chmod? / What is chmod?
    SMF Online Manual
  2. Why chmod 777 is NOT a security risk
    Date: November 20, 2003
    Simple Machines Forum
  3. Packages directory or one of the files in it are not writable!"
    Date: October 5, 2008
    Simple Machines Forum
  4. Download Packages
    SMF Online Manual
  5. Update 1.1.12 Packages question
    Date: November 9, 2010
    Simile Machines Forum

Valid HTML 4.01 Transitional

Created: January 15, 2011