1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Call to undefined function error

Discussion in 'Co-op Advertising Network' started by Patient, Nov 2, 2004.

  1. #1
    On one of my sites I get the error message:

    Call to undefined function: file_get_contents()

    A header checker says:
    SEMrush
    HTTP/1.1 200 OKDate: Tue, 02 Nov 2004 13:29:00 GMTServer: Apache/1.3.27 (Unix) (Red-Hat/Linux) Chili!Soft-ASP/3.6.2 mod_ssl/2.8.14 OpenSSL/0.9.6b PHP/4.1.2 FrontPage/5.0.2.2510X-Powered-By: PHP/4.1.2Connection: closeContent-Type: text/html

    So I searched through this forum and found a hack. However, when I add the hack I now get:

    Fatal error: Cannot redeclare file_get_contents()

    How wierd is that - can anyone help please.
     
    Patient, Nov 2, 2004 IP
    SEMrush
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,220
    Likes Received:
    778
    Best Answers:
    0
    Trophy Points:
    0
    #2
    undefined indicates the PHP version is too low and doesn't support that function.

    redeclare problem would indicate you are either including the function twice, hence trying to redeclare it but impossible to do so. Or you are looping through a while or for loop and 'jump up' in the script to above the function, thus trying to redeclare it again.

    My guess is you are inclduing a file with that (compat?) function multiple times. Break the function out of that code and include it just once above all the others.
     
    T0PS3O, Nov 2, 2004 IP
  3. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #3
    Thanks TOPS30

    Of course... as I am running 5 ads I am calling ad_network.php 5 times and declaring the function each time.

    Moving it into an include file didn't work though as it also is being included 5 times.

    Any good ideas?

    inserted:



    Thanks for your help - I have fixed it now.

    Basically I used Shawn's hack for users of < php4.3 - but as I was running 5 ads it was trying to define file_get_contents more than once.

    I have moved Shawn's hack to a file named ads_include.php and added the following to ads_network.php

    include_once ('ads_include.php')

    and its now working OK
     
    Patient, Nov 2, 2004 IP