Jump to content



Photo
- - - - -

PHP Fatal Error


This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1   newinmn

newinmn
  • Members
  • 8 posts

Posted 10 March 2011 - 01:33

PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php on line 345



}

else {

//New vistor, so record referrer, etc

//Next line defines pages on which a new visitor should definitely not be recorded

$prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

$current_page=addslashes(tep_db_input(urldecode($_SERVER['PHP_SELF'])));



if (!strpos($prohibited_pages, $current_page)) {


Line 345 is: $prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

Any ideas on how to fix this? Thank you.

Edited by newinmn, 10 March 2011 - 01:34.


#2   newinmn

newinmn
  • Members
  • 8 posts

Posted 10 March 2011 - 22:35

Any help would be greatly appreciated. This is the one error preventing this page from showing up right now. Thanks!

#3   dfirefire

dfirefire

    For hire

  • Community Sponsor
  • 147 posts

Posted 11 March 2011 - 16:49

?? are you sure this is the code from
/home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php

This doesn't make sense, there should be a statement like
geoip_open(
in the file.
You might want to perform a search to find that statement in your files and proceed from there...
dfirefire
Web Application Developer

Did you like my post? Click the "Like this"-button.
Want to contact me? Check out my profile!

#4   newinmn

newinmn
  • Members
  • 8 posts

Posted 11 March 2011 - 17:36

?? are you sure this is the code from

/home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php

This doesn't make sense, there should be a statement like
geoip_open(
in the file.
You might want to perform a search to find that statement in your files and proceed from there...


Here is more.

}

else {

//New vistor, so record referrer, etc

//Next line defines pages on which a new visitor should definitely not be recorded

$prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

$current_page=addslashes(tep_db_input(urldecode($_SERVER['PHP_SELF'])));



if (!strpos($prohibited_pages, $current_page)) {

$refer_data = addslashes(tep_db_input(urldecode($_SERVER['HTTP_REFERER'])));

$refer_data = explode('?', $refer_data);

$referrer=$refer_data[0];

$query_string=$refer_data[1];



$ip = $_SERVER['REMOTE_ADDR'];

$browser_string = addslashes(tep_db_input(urldecode($_SERVER['HTTP_USER_AGENT'])));



include(DIR_WS_INCLUDES . "geoip.inc");

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

$country_name = geoip_country_name_by_addr($gi, $ip);

$country_code = strtolower(geoip_country_code_by_addr($gi, $ip));

geoip_close($gi);





$time_arrived = date('Y-m-d H:i:s');

$landing_page = addslashes(tep_db_input(urldecode($_SERVER['REQUEST_URI'])));

$query = "INSERT INTO `supertracker` (`ip_address`, `browser_string`, `country_code`, `country_name`, `referrer`,`referrer_query_string`,`landing_page`,`exit_page`,`time_arrived`,`last_click`) VALUES ('" . $ip . "','" . $browser_string . "','" . $country_code . "', '" . $country_name . "', '" . $referrer . "', '" . $query_string . "','" . $landing_page . "','" . $current_page . "','" . $time_arrived . "','" . $time_arrived . "')";

tep_db_query($query);



}//end if for prohibited pages

}//end else


Neither myself, or anyone at the hosting company knows how to resolve this. Also, why when I type in domain.com does it redirect to domain.com/osc? When I try and just get to the site I get a white screen. Very frustrating. Things were great before the transfer. Should I delete all file and load a fresh osCommerce then upload all files again? I'm really stuck here without a site. Thanks.

#5   dfirefire

dfirefire

    For hire

  • Community Sponsor
  • 147 posts

Posted 11 March 2011 - 17:50

Here's the culprit:
include(DIR_WS_INCLUDES . "geoip.inc");

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

Checks you should do:
1. are the DIR_WS_INCLUDES . "geoip.inc" (= /includes/geoip.inc) and DIR_WS_INCLUDES . "GeoIP.dat" present? Try changing the command "include(" to "require(", this will give an error when the file is not present (assuming that your server is set up to show errors, otherwise you'll see a blank page).
2. open the file geoip.inc and look if the function "geoip_open(" exists.

About the domain root: check your root folder for index.htm(l) files containing a 'meta="refresh" '-statement or a .htaccess file with redirect instructions, like
Redirect 301 / http://www.example.com/osc/

dfirefire
Web Application Developer

Did you like my post? Click the "Like this"-button.
Want to contact me? Check out my profile!

#6   newinmn

newinmn
  • Members
  • 8 posts

Posted 11 March 2011 - 19:13

1. DIR_WS_INCLUDES . "geoip.inc" (= /includes/geoip.inc) and DIR_WS_INCLUDES . "GeoIP.dat" are present.

When I change from include to require I get the following error:
PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371

This line is:
$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

2. open the file geoip.inc and look if the function "geoip_open(" exists.
It does not. There are things such as the following:
define("GEOIP_COUNTRY_BEGIN", 16776960);

define("GEOIP_STATE_BEGIN_REV0", 16700000);

but nothing that specifically says that.

The heading on this file says:
* 2005-01-13 Andrew Hill, Awarez Ltd. (http://www.awarez.net)

* Formatted file according to PEAR library standards.

* Moved $GEOIP_COUNTRY_CODE_TO_NUMBER, $GEOIP_COUNTRY_CODES,

* $GEOIP_COUNTRY_CODES3 and $GEOIP_COUNTRY_NAMES into the

* GeoIP class, so that library will still work even when

* not included in the $GLOBAL context.


As far as the domain root:
This is at the top of the index file:

<HTML dir=ltr lang=en><HEAD><TITLE>domain.com</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type><BASE href="http://www.domain.co...com/osc/"><LINK rel=stylesheet type=text/css href="stylesheet.css"></HEAD>

#7   dfirefire

dfirefire

    For hire

  • Community Sponsor
  • 147 posts

Posted 11 March 2011 - 19:50

I've downloaded and checked the contribution and came to the following conclusion:

The function geoip_open does exist in geoip.inc, but I think the PHP processor doesn't read it right.

Try changing the geoip.inc filename to geoip.inc.php. Don't forget to do a search-and-replace in the including files to change the filename there too...
dfirefire
Web Application Developer

Did you like my post? Click the "Like this"-button.
Want to contact me? Check out my profile!

#8   newinmn

newinmn
  • Members
  • 8 posts

Posted 11 March 2011 - 20:21

I did this and get the following errors:

PHP Warning: Cannot modify header information - headers already sent by (output started at /home/merchant/public_html/domain.com/osc/includes/languages/english.php:597) in /home/merchant/public_html/domain.com/osc/includes/functions/general.php on line 33

This is:

header('Location: ' . $url);

PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371

This is:

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

Edited by newinmn, 11 March 2011 - 20:22.


#9   dfirefire

dfirefire

    For hire

  • Community Sponsor
  • 147 posts

Posted 11 March 2011 - 22:25

Make sure there are no empty lines at the beginning and the end of the geoip.inc.php file (before the <?php and after the ?>), this causes that error msg "headers already sent"...
dfirefire
Web Application Developer

Did you like my post? Click the "Like this"-button.
Want to contact me? Check out my profile!

#10   newinmn

newinmn
  • Members
  • 8 posts

Posted 11 March 2011 - 23:10

One down, still have the PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371 problem.

Also I changed <META HTTP-EQUIV="refresh" content="0;URL=http://www.domain.com/osc"> to:

<META content="0;URL=http://www.domain.com">

But, why would they have it set up this way in the first place? Why redirect? There is an oscommerce page I used to login to that would actually allow me to make easy changes and that is not showing up either. Just not sure why it would have been setup for domain.com/osc in the first place.