Problems with Webinstall.php

Started by JacobsWellMC, September 26, 2009, 01:23:22 PM

Previous topic - Next topic

JacobsWellMC

I am having some problems with Webinstall.

On the step after I fill out my FTP information, I get the following error
QuoteWarning: unpack() [function.unpack]: Type H: not enough input, need 1, have 0 in /home/content/j/a/c//html/forum/webinstall.php on line 982
The installer was unable to download the archive (http://mirror.pdx.simplemachines.org/index.php/smf_2-0-rc1-2_install.tar.gz) from the server. Please try using the regular installer package instead.

Click here to try this step again.

Is there something I'm doing wrong?

JacobsWellMC

I'm sorry, I posted this in the wrong section   :-[

JacobsWellMC


H

Sometimes servers are locked down in such a way that webinstall will not work. As the error suggests, you should try using the full install package instead :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

radzior

so why smf still promotes this install method?

Liam.

Because it does work on most servers, it's just certain ones that don't allow it.

KensonPlays

is godaddy one of them? if so, does Bluehost support this?

Owner of Mesozoic Haven

MoreBloodWine

Same exact problem for me... I think someone should check into line 982 instead of suggesting the full install. Dont get me wrong, yes most of us will end up having to use it but the big issue seems to be the ignoring if the error itself.

For me, sometimes it works and sometimes it dont but when it doesnt it's always the same error. Also let me stop you before you ask "did your server change any settings" because the answer is no. Servers the exact same way it wasy from day one. Just like I said sometimes webinstall works and sometimes it dont but when it doesnt its ALWAYS the same error.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


H

MoreBloodWine, the error in the first post indicates that the file cannot be downloaded from our website. Either our website is having problems (unlikely most of the time) or there are problems downloading the file. Various factors such as php timeouts, slow DNS etc can mean that your server may not always be able to download the file from our site. This shouldn't be the case, however many servers are not optimised for things like this.
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

MoreBloodWine

Quote from: H on November 30, 2009, 04:19:08 PM
MoreBloodWine, the error in the first post indicates that the file cannot be downloaded from our website. Either our website is having problems (unlikely most of the time) or there are problems downloading the file. Various factors such as php timeouts, slow DNS etc can mean that your server may not always be able to download the file from our site. This shouldn't be the case, however many servers are not optimised for things like this.
So for the people it usually works for but isnt now while getting the referenced error and whos servers havent changed than I guess that means SMF has been hiccuping for the past 2 months for me then ?
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


H

QuoteVarious factors such as php timeouts, slow DNS etc can mean that your server may not always be able to download the file from our site
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

MoreBloodWine

Cute and suttle... nice job you actually made me laugh.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

Lets just for arguments sake forget everything thats been said thusfar. Is there something in a custom php.ini file that may also interfere with this ?
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


H

If it works sometimes and not others it probably isn't php that is at fault (although if it is a timeout you can try changing the timeout for fsockopen which I believe may be in php.ini).

Often webservers do not have DNS resolvers that work particularly fast either
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

MoreBloodWine

Quote from: H on December 03, 2009, 04:16:43 PM
If it works sometimes and not others it probably isn't php that is at fault (although if it is a timeout you can try changing the timeout for fsockopen which I believe may be in php.ini).

Often webservers do not have DNS resolvers that work particularly fast either
At this point anything is worth trying so I'll give that a shot.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


H

If you're installing SMF on a regular basis though, you could just keep the SMF archives in a folder on your site. When you need another install, copy them to the relevant location and then extract them using your control panel.

Not quite as elegant as webinstall, but nonetheless a useable workaround if there are server issues :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

SlammedDime

i hate to step on toes, but this is a bug in webinstall.php...

open the webinstall.php file and replace the fetch_web_data function with the following, then try again

function fetch_web_data($url, $post_data = '', $keep_alive = false, $redirection_level = 0)
{
global $webmaster_email;
static $keep_alive_dom = null, $keep_alive_fp = null;

preg_match('~^(http|ftp)(s)?://([^/:]+)(:(\d))?(.+)$~', $url, $match);

// An FTP url. We should try connecting and RETRieving it...
if (empty($match[1]))
return false;
elseif ($match[1] == 'ftp')
{
// Establish a connection and attempt to enable passive mode.
$ftp = new ftp_connection(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? 21 : $match[5], 'anonymous', '[email protected]');
if ($ftp->error !== false || !$ftp->passive())
return false;

// I want that one *points*!
fwrite($ftp->connection, 'RETR ' . $match[6] . "\r\n");

// Since passive mode worked (or we would have returned already!) open the connection.
$fp = @fsockopen($ftp->pasv['ip'], $ftp->pasv['port'], $err, $err, 5);
if (!$fp)
return false;

// The server should now say something in acknowledgement.
$ftp->check_response(150);

$data = '';
while (!feof($fp))
$data .= fread($fp, 4096);
fclose($fp);

// All done, right?  Good.
$ftp->check_response(226);
$ftp->close();
}
// This is more likely; a standard HTTP URL.
elseif (isset($match[1]) && $match[1] == 'http')
{
if ($keep_alive && $match[3] == $keep_alive_dom)
$fp = $keep_alive_fp;
if (empty($fp))
{
// Open the socket on the port we want...
$fp = @fsockopen(($match[2] ? 'ssl://' : '') . $match[3], empty($match[5]) ? ($match[2] ? 443 : 80) : $match[5], $err, $err, 5);
if (!$fp)
return false;
}

if ($keep_alive)
{
$keep_alive_dom = $match[3];
$keep_alive_fp = $fp;
}

// I want this, from there, and I'm not going to be bothering you for more (probably.)
if (empty($post_data))
{
fwrite($fp, 'GET ' . $match[6] . ' HTTP/1.0' . "\r\n");
fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
fwrite($fp, 'User-Agent: PHP/SMF' . "\r\n");
if ($keep_alive)
fwrite($fp, 'Connection: Keep-Alive' . "\r\n\r\n");
else
fwrite($fp, 'Connection: close' . "\r\n\r\n");
}
else
{
fwrite($fp, 'POST ' . $match[6] . ' HTTP/1.0' . "\r\n");
fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
fwrite($fp, 'User-Agent: PHP/SMF' . "\r\n");
if ($keep_alive)
fwrite($fp, 'Connection: Keep-Alive' . "\r\n");
else
fwrite($fp, 'Connection: close' . "\r\n");
fwrite($fp, 'Content-Type: application/x-www-form-urlencoded' . "\r\n");
fwrite($fp, 'Content-Length: ' . strlen($post_data) . "\r\n\r\n");
fwrite($fp, $post_data);
}

$response = fgets($fp, 768);

// Redirect in case this location is permanently or temporarily moved.
if ($redirection_level < 3 && preg_match('~^HTTP/\S+\s+30[127]~i', $response) === 1)
{
$header = '';
$location = '';
while (!feof($fp) && trim($header = fgets($fp, 4096)) != '')
if (strpos($header, 'Location:') !== false)
$location = trim(substr($header, strpos($header, ':') + 1));

if (empty($location))
return false;
else
{
if (!$keep_alive)
fclose($fp);
return fetch_web_data($location, $post_data, $keep_alive, $redirection_level + 1);
}
}

// Make sure we get a 200 OK.
elseif (preg_match('~^HTTP/\S+\s+20[01]~i', $response) === 0)
return false;

// Skip the headers...
while (!feof($fp) && trim($header = fgets($fp, 4096)) != '')
{
if (preg_match('~content-length:\s*(\d+)~i', $header, $match) != 0)
$content_length = $match[1];
elseif (preg_match('~connection:\s*close~i', $header) != 0)
{
$keep_alive_dom = null;
$keep_alive = false;
}

continue;
}

$data = '';
if (isset($content_length))
{
while (!feof($fp) && strlen($data) < $content_length)
$data .= fread($fp, $content_length - strlen($data));
}
else
{
while (!feof($fp))
$data .= fread($fp, 4096);
}

if (!$keep_alive)
fclose($fp);
}
else
{
// Umm, this shouldn't happen?
trigger_error('fetch_web_data(): Bad URL', E_USER_NOTICE);
$data = false;
}

return $data;
}
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

MoreBloodWine

Quote from: H on December 03, 2009, 04:41:43 PM
If you're installing SMF on a regular basis though, you could just keep the SMF archives in a folder on your site. When you need another install, copy them to the relevant location and then extract them using your control panel.

Not quite as elegant as webinstall, but nonetheless a useable workaround if there are server issues :)
True, I'm also gonna try SlamDimes suggestion first just for the heck of it since I've been suggesting it's a bug for a good long while (not in this threadh but others) but never really knew where to look for a fix.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

It's official... SlamDimes fix for the "bug" worked first shot... so how do we get this to the DEV's so they can fix the webinstall file with SlamDime's patch ?
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


SlammedDime

I'll be fixing it in Trunk and sending it to the beta testers shortly for review.  I just haven't had time in the last few weeks since I tracked the bug down to get it committed to SVN yet.

For the time being, we'll keep this topic marked as solved though.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: