Support » Plugin: WooCommerce » Woocommerce WP plugin activation error

  • Hi there, I have just downloaded the latest Woocommerce plugin and when I try to activate it gives this fatal error:
    “Fatal error: Cannot redeclare maybe_create_table() (previously declared in /websites/123reg/LinuxPackage22/ke/rt/o_/ in /websites/123reg/LinuxPackage22/ke/rt/o_/ on line 1393”

    I’ve been around the block with this one: contacted the hosting company first, then the guys who supplied the theme and they both pointed me to you guys due to the nature of the error message which is in WP admin etc. Could someone please help me out as I really need to sort this ASAP!
    Thank you ever so much in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • This one seems to have been round for a while.

    You could try editing the file at wp-admin/includes/upgrade.php at line 1383 and temporarily add an x before maybe, thus renaming the second copy of the function.

    Thanks lorro! Do excuse my ignorance, by second copy of function you mean I create exactly the same function again just above/below the current one? Last time some one tried to edit something in that file, it took the whole site down!!

    No, don’t create a new function. The first copy of the function is in
    wp-admin/install-helper.php at line 53, leave that one.
    The second copy is in:
    wp-admin/includes/upgrade.php at line 1393. Rename that one so you don’t have two functions with the same name. As a method, it a bit rough and ready but it might get you going.

    Yes the site will come down if the edit is incorrect. If you are worried, take a backup of the file you are editing.

    OK, I understand. My only concern with this method is: will this little ‘x’ in front of maybe_create_table (xmaybe_create_table) make that function redundant and faulty so something else that might be using it will not be able to function properly after this?

    “function maybe_create_table($table_name, $create_ddl) {
    global $wpdb;
    if ( $wpdb->get_var(“SHOW TABLES LIKE ‘$table_name'”) == $table_name )
    return true;
    //didn’t find it try to create it.
    $q = $wpdb->query($create_ddl);
    // we cannot directly tell that whether this succeeded!
    if ( $wpdb->get_var(“SHOW TABLES LIKE ‘$table_name'”) == $table_name )
    return true;
    return false;

    Yes, hence temporary.

    OK, I’ve tried it, didn’t break the site so that’s good BUT it now gives a different fatal error: “Fatal error: Cannot redeclare maybe_add_column() (previously declared in /websites/123reg/LinuxPackage22/ke/rt/o_/ in /websites/123reg/LinuxPackage22/ke/rt/o_/ on line 1458”

    OK, try the same solution. Add an x before maybe in upgrade.php line 1458.

    Its hassle but the alternative is the debug procedure which is lengthy.

    Yes that has worked!!! Thank you! But for how long will that work for, goodness only knows…
    I have many products which I will be creating now so I really don’t want this to break half way somewhere… And if I reverse the changes (ie remove the ‘x’ in front of those declarations) the Woocommerce will break again?

    Suggest you reverse the two changes that you made. If the errors recur when you update WooCommerce, you will know what to do.

    Loads of people install and update WooCommerce without this problem so there is a conflict or corruption in your setup somewhere. Finding that conflict can take ages.

    Protect the product data by backing it up regularly. Dashboard / Tools / Export should do the job, and also there are plugins to do it.

    Arggh, it was all working fine but now the wholse site is down again, I can’t even access the admin panel, so the only option is http://ftp…the error this time:
    “Fatal error: Call to undefined function get_userdata() in /websites/123reg/LinuxPackage22/ke/rt/o_/ on line 993”
    Help please?!
    BTW. is this normal, so many fatal errors I mean? What would you do if it was your own site?

    This is the function that gives the current error:

    “function register($user_ID = 0, $consent = false) {
    global $wpdb;

    if ( 0 == $user_ID ) { return $user_ID; }
    $user = get_userdata($user_ID);

    // Subscribe registered users to categories obeying excluded categories
    if ( 0 == $this->subscribe2_options[‘reg_override’] || ‘no’ == $this->subscribe2_options[‘newreg_override’] ) {
    $all_cats = $this->all_cats(true, ‘ID’);
    } else {
    $all_cats = $this->all_cats(false, ‘ID’);

    $cats = ”;
    foreach ( $all_cats as $cat ) {
    (” == $cats) ? $cats = “$cat->term_id” : $cats .= “,$cat->term_id”;

    if ( ” == $cats ) {
    // sanity check, might occur if all cats excluded and reg_override = 0
    return $user_ID;

    PS. I have temporarily renamed the subscribe2 folder to deactivate the plugin but it’s not a long term solution… Any ideas?

    These sorts of errors are not normal I would say. There are not many issues like this in the forums given the size of the userbase.

    If you delete the directory and files at
    that should get you back in. The plugin’s data will be in the database and will not be affected.

    Make sure you are using the latest version of your theme.

    If you are, or if the problems persist, it does look like you have a conflict, corruption or incomplete install of something. The normal recommendation at this point is to disable all the plugins to see if the problems go away, then reinstall them one-by-one, then try the default theme to be able to rule out theme problems, but the faults are haphazard so I can’t see this procedure being able to pinpoint the problem. If it were my site, I would give up trying to fix it.

    I would save the database, ensuring it was a good copy, then delete all files except wp-config, .htaccess and the contents of the of the wp-content directory. Then reload WordPress, theme and plugins from fresh downloads. It’ll be quicker than a debug and more likely to give a good result.

    The pages and products should still just be there, but some of the settings in the plugins may need to be reset.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Woocommerce WP plugin activation error’ is closed to new replies.