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:

    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/ 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
  2. T0PS3O

    T0PS3O Feel Good PLC

    Likes Received:
    Best Answers:
    Trophy Points:
    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

    Likes Received:
    Best Answers:
    Trophy Points:
    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?


    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