Blank page error in SMF

Sohail

Active Member
Messages
3,055
Reaction score
0
Points
36
Okay well i t still isn't up yet. Are you uploading the files via FTP?
If so, then it maybe because there is come sort of cache on the server which is not refreshed until every few hours, i've had that problem and it is something that cannot be fixed at the moment...

Hope this helps...
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
If there are any htaccess filers in the root of SMF...get rid of them and see if it works.
 

ZinnKid

New Member
Messages
10
Reaction score
0
Points
0
I also get the blank page when I try to use SMF. I have to refresh the page 10+ time to get it to load. According to the error log, the problem is with this part of the Subs.php

Code:
// Lookup an IP; try shell_exec first because we can do a timeout on it.
function host_from_ip($ip)
{
	global $modSettings;

	if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null)
		return $host;
	$t = microtime();

	// If we can't access nslookup/host, PHP 4.1.x might just crash.
	if (@version_compare(PHP_VERSION, '4.2.0') == -1)
		$host = false;

	// Try the Linux host command, perhaps?
	if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && rand(0, 1) == 1)
	{
		if (!isset($modSettings['host_to_dis']))
			$test = @shell_exec('host -W 1 ' . @escapeshellarg($ip));
		else
			$test = @shell_exec('host ' . @escapeshellarg($ip));

		// Did host say it didn't find anything?
		if (strpos($test, 'not found') !== false)
			$host = '';
		// Invalid server option?
		elseif ((strpos($test, 'invalid option') || strpos($test, 'Invalid query name 1')) && !isset($modSettings['host_to_dis']))
			updateSettings(array('host_to_dis' => 1));
		// Maybe it found something, after all?
		elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1)
			$host = $match[1];
	}

	// This is nslookup; usually only Windows, but possibly some Unix?
	if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && rand(0, 1) == 1)
	{
		$test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip));
		if (strpos($test, 'Non-existent domain') !== false)
			$host = '';
		elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1)
			$host = $match[1];
	}

	// This is the last try :/.
	if (!isset($host) || $host === false)
		$host = @gethostbyaddr($ip);

	// It took a long time, so let's cache it!
	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5)
		cache_put_data('hostlookup-' . $ip, $host, 600);

	return $host;
}

See, the problem is that the shell_exec() function is disabled in the Basic and Intermediate versions of the PHP. I believe upgrading to Advanced PHP would solve this.
 

LHVWB

New Member
Messages
1,308
Reaction score
0
Points
0
I'm on intermediate php, and I have exactly the same issue, except that it seems to be a bit less frequent and I only have to reload the page 3-5 times,(at the momen).

I'll try to upgrade to the advance form of php and see if it solves the problem.

It also seems that from a search for that function on the forums, that lots of people have had this issue, and the shell_exec() is on the advance version. Someone managed to fix the issue by turning off the host lookup option somewhere.
 
Last edited:

TheMan177

New Member
Messages
179
Reaction score
0
Points
0
You could also try disabling hostname lookups.

Edit: I should read better
 
Last edited:

ZinnKid

New Member
Messages
10
Reaction score
0
Points
0
Well, I put // in some lines and as far as I can tell, it worked.

Code:
// Lookup an IP; try shell_exec first because we can do a timeout on it.
function host_from_ip($ip)
{
	global $modSettings;

	if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null)
		return $host;
	$t = microtime();

	// If we can't access nslookup/host, PHP 4.1.x might just crash.
	if (@version_compare(PHP_VERSION, '4.2.0') == -1)
		$host = false;

	// Try the Linux host command, perhaps?
	if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && rand(0, 1) == 1)
	{
//		if (!isset($modSettings['host_to_dis']))
//			$test = @shell_exec('host -W 1 ' . @escapeshellarg($ip));
//		else
//			$test = @shell_exec('host ' . @escapeshellarg($ip));

		// Did host say it didn't find anything?
//		if (strpos($test, 'not found') !== false)
			$host = '';
		// Invalid server option?
//		elseif ((strpos($test, 'invalid option') || strpos($test, 'Invalid query name 1')) && !isset($modSettings['host_to_dis']))
			updateSettings(array('host_to_dis' => 1));
		// Maybe it found something, after all?
//		elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1)
//			$host = $match[1];
	}

	// This is nslookup; usually only Windows, but possibly some Unix?
	if (!isset($host) && strpos(strtolower(PHP_OS), 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && rand(0, 1) == 1)
	{
//		$test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip));
		if (strpos($test, 'Non-existent domain') !== false)
			$host = '';
		elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1)
			$host = $match[1];
	}

	// This is the last try :/.
	if (!isset($host) || $host === false)
		$host = @gethostbyaddr($ip);

	// It took a long time, so let's cache it!
	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5)
		cache_put_data('hostlookup-' . $ip, $host, 600);

	return $host;
}

I can't seem to find the "disable hostname lookup" option. So for now, I'll just use this.

[EDIT]
Ok, I found the "disable hostname lookup" option at /index.php?action=featuresettings;sa=layout so I removed my edits to Subs.php and it worked.

Case Closed, Problem Solved
 
Last edited:
Top