PHP Configuration Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ronni_e
Forum Newbie
Posts: 5
Joined: Thu Sep 18, 2003 3:28 pm

PHP Configuration Error

Post by ronni_e »

Can someone tell me what setting I need to change in my PHP.INI file to get this error to go away? http://ronnie.vonetwork.com/index2.php? If you visit my current website at http://www.ronniewilliams.net/index2.php you will see that error isnt there but I dont have access to the PHP.INI file there so I cant see how its set. I need to know what setting to change at the vonetwork site to get this error to go away.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

in this case you don't wanna touch the error reporting level. why? they turn it most if not allt he way off for security.

this is a simple matter.

my guess is you have an include for functions, and other stuff.
you have a function in that particular page

so you include the file twice. wanna get around it?

adjust your includes like this:

a: include two files elsewhere, just the variables and not the functins in a page's functions

b:
make an include file that includes the two files that you include elsewhere and only include variables in functions in a page.

in either of those cases split the functions and ariables.

you see the issue is simple: you're declaring a function twice and if you plan on using the second version then you need to be warned because you'll only be using the first.


i had that same issue when i modularized the site i'm working on. i did the latter since i now have two variables files
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

You could post the 116th line in the class_poll.php file, and we'll see what that gives us...

I'm thinking that the poll-file uses the $_GET enviroment to get pollvalues (uhmmm sounded wierd) and it cant grasp the fact that the ? at the end of the URI isn't have to mean anything...

Don't think you should touch them ini file for various reasons...
ronni_e
Forum Newbie
Posts: 5
Joined: Thu Sep 18, 2003 3:28 pm

Code in Question

Post by ronni_e »

Here is the code in question:

Code: Select all

function set_max_bar_length($max_bar_length='') {
        if ($max_bar_length && $max_bar_length>0) {
            $this->pollvars['img_length'] = $max_bar_length;
            return true;
        } else {
            return false;
        }
    }

    function set_max_bar_height($max_bar_height='') {
        if ($max_bar_height && $max_bar_height>0) {
            $this->pollvars['img_height'] = $max_bar_height;
            return true;
        } else {
            return false;
        }
    }
    
    function get_poll_tpl($tpl) {
        $filename = "$this->include_path/templates/$this->template_set/$tpl.html";
        if (file_exists("$filename")) {
            $fd = fopen ($filename, "r");
            $template = fread ($fd, filesize ($filename));
            fclose ($fd);
            $template = ereg_replace(""", """, $template);
            return $template;
        } else {
            return false;
        }
    }

    function set_max_bar_length($max_bar_length='') {
        if ($max_bar_length && $max_bar_length>0) {
            $this->pollvars['img_length'] = $max_bar_length;
        }
        return $this->pollvars['img_length'];
    }
Line 116 is the last function set_max_bar_length. This is a pre-written code so I dont know how to modify it to make it work to my needs. I dont understand why it works on my current web host but not on the new webhost im going to.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you changed the code at all when moving your site? Is it possible that you're including the code for the poll twice?

If you're using include() or require() to include the file try include_once() or require_once() instead.

Mac
ronni_e
Forum Newbie
Posts: 5
Joined: Thu Sep 18, 2003 3:28 pm

follow up

Post by ronni_e »

the only code that was changed was the file that contains my database settings. other than that all was left the same as on the web host where the script is working fine. the script that is working fine has PHP 4.2.2 while the version that isnt working has 4.3.3.. any changes in the versions of PHP that might affect this?
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Re: Code in Question

Post by m3rajk »

ronni_e wrote:Here is the code in question:

Code: Select all

function set_max_bar_length($max_bar_length='') {
        if ($max_bar_length && $max_bar_length>0) {
            $this->pollvarsї'img_length'] = $max_bar_length;
            return true;
        } else {
            return false;
        }
    }
    function set_max_bar_length($max_bar_length='') {
        if ($max_bar_length && $max_bar_length>0) {
            $this->pollvarsї'img_length'] = $max_bar_length;
        }
        return $this->pollvarsї'img_length'];
    }
Line 116 is the last function set_max_bar_length. This is a pre-written code so I dont know how to modify it to make it work to my needs. I dont understand why it works on my current web host but not on the new webhost im going to.
i removed some of your code.... notice anything????

note: i was wrong with why you were getting the error but not what it was. if i'm not mistaken they are identical. try removing one. it should still work perfectly
ronni_e
Forum Newbie
Posts: 5
Joined: Thu Sep 18, 2003 3:28 pm

removed one

Post by ronni_e »

I removed one like you said.. it now displays.. however try to place a vote.. http://ronnie.vonetwork.com/index2.php
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

workd for me
Post Reply