Package Manager - An Error Has Occurred!

When attempting to install a mod in a Simple Machines Forum (SMF) mod, I saw the error below from the Package Manager page for the forum whenever I tried to download or upload the package:

An Error Has Occurred!

Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF.

When I checked the Sources, Packages directory and the temp directory within it, all were writable by the owner, group, and others having file permissions of 777.

# ls -ldgG Sources Packages Packages/temp
drwxrwxrwx. 4   84 Aug 23 13:54 Packages
drwxrwxrwx. 2    6 Aug 23 13:54 Packages/temp
drwxrwxrwx. 2 4096 Aug 22 22:28 Sources

The temp directory wasn't empty, but should have been, though, since there were no packages pending installation. I deleted everything in the temp directory and tried again, but received the same error whenever I tried to upload or download the file. I thought I might have created the problem when I previously deleted the zip file for the mod from the Packages directory, so I copied the zip file back into the Packages directory. I then received the following error message, instead, when I tried to upload the zip file for the mod:

An Error Has Occurred!

The file you are uploading already exists on the server. Please delete it first then try again.

So I deleted the zip file I manually copied to the Packages directory. When I tried to download from a URL again, I was back at the original error message.

So I looked for the location of the file containing the error message.

$ grep -rwl "Although the package was downloaded" --include=*.php
Themes/default/languages/Errors.english.php

I then examined the Themes/default/languages/Errors.english.php file. The error message is stored at:

$txt['package_get_error_is_zero'] = 'Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:<br />1) Download the package to your local PC and extract it into files.<br />2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".<br />3) Upload all the files from the extracted package to this directory.<br />4) Go back to the package manager browse page and the package will be automatically found by SMF.';

So then I needed to locate the PHP file that loaded the error message using package_get_error_is_zero.

$ grep -rwl "package_get_error_is_zero" --include=*.php
Sources/Subs-Package.php
Sources/PackageGet.php
Themes/default/languages/Errors.english.php

In Sources/PageGet.php, I found the following:

 // To download something, we need a valid server or url.
        if (empty($_GET['server']) && (!empty($_GET['get']) && !empty($_REQUEST['package'])))
                fatal_lang_error('package_get_error_is_zero', false);

In Sources/PageGet.php, I found that package_get_error_is_zero ocurs in the function getPackageInfo.

I also noticed that there were two files related to the httpBL mod I was attempting to install in the Sources directory.

# ls -lgG Sources/httpBL*
-rw-rw-rw-. 1 23217 Aug 23 11:56 Sources/httpBL_2_Config.php
-rwxrwxrwx. 1 36502 Aug 23 11:56 Sources/httpBL_Subs.php

The time stamps on them showed they were created when I tried unsuccessfully installing the mod earlier today. I deleted both files.I then tried downloading the mod again, but received the original error message again.

When I looked for any other files created in the Sources directory today, I saw the following:

# ls -algG Sources | grep "Aug 23"
drwxrwxrwx. 2   4096 Aug 23 14:36 .
drwxrwxrwx. 9   4096 Aug 23 13:58 ..
-rw-rw-rw-. 1  37494 Aug 23 11:56 Admin.php~
-rw-rw-rw-. 1  75762 Aug 23 11:56 ManagePermissions.php~

There didn't seem to be anything left there that was created today that would explain the problem, so then I began to wonder if the problem was in the zip file itself. I had changed one of the files within the original zip file for httpBL, so I tried downloading the original version instead. I didn't have the problem with that file. Instead, I saw "The package has been uploaded successfully". When I checked the Packages directory, I saw that the zip file was placed there. There were no files in the temp directory.

$ ls Packages 
backups  httpBL_v2_5_1.zip  index.php  installed.list  temp
$ ls Packages/temp
$ ls -lgG Packages/httpBL_v2_5_1.zip 
-rwxrwxrwx. 1 75727 Aug 23 14:56 Packages/httpBL_v2_5_1.zip

As a test, from the Package Manager page, I chose Browse Packages and deleted the httpBL package I had just downloaded. That deleted the zip file for the package from the Packages directory.

$ ls -lgG Packages
total 4
drwxrwxrwx. 2  83 Aug 22 22:28 backups
-rw-r--r--. 1 324 Apr 22 12:34 index.php
-rwxrwxrwx. 1   0 Apr 22 12:34 installed.list
drwxrwxrwx. 2   6 Aug 23 13:54 temp

I tried downloading the modified zip file I created from the same URL again. I received the original error message when I attempted to do so.

I had modified a file within the zip file as noted in http:BL Database Error and then recreated the zip file. I had done that on the Linux server on which the forum resides. I then took the original zip file from the developer of the mod, edited the same file on a Microsoft Windows system and recreated the zip file on that system. When I then used that new zip file, the problem went away and I was able to successfully install the mod.

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Sunday August 23, 2015