• Resolved mattgivertz

    (@mattgivertz)


    I have tried to install the plug-in and it fails on activation. I am running WordPress 5.4.1 and PHP 7.3.18-1+ubuntu18.04.1+deb.sury.org+1 with MySQL version 5.7.29-32-log. Seems like there is a SQL syntax error when creating the tables ??

    This is the WordPress error received

    [Tue Jun 02 20:00:47.793299 2020] [php7:notice] [pid 30118] [client 86.182.80.181:52568] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT’ at line 1 for query ALTER TABLE wp_ratings CHANGE COLUMN rating_id rating_id INT(11) NOT NULL auto_increment,rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT(2) NOT NULL ,rating_timestamp VARCHAR(15) NOT NULL ,rating_ip VARCHAR(40) NOT NULL ,rating_host VARCHAR(200) NOT NULL,rating_username VARCHAR(50) NOT NULL,rating_userid int(10) NOT NULL default ‘0’,PRIMARY KEY (rating_id),KEY rating_userid (rating_userid),KEY rating_postid_ip (rating_postid, rating_ip) /* From [bags-of-books.co.uk/wp-admin/network/plugins.php?action=activate&networkwide=1&plugin=wp-postratings%2Fwp-postratings.php&_wpnonce=9d69864a0d] in [/nas/content/live/bagsofbomaster/wp-content/plugins/wp-postratings/includes/postratings-activation.php:56] */ made by require(‘wp-admin/plugins.php’), activate_plugin, do_action(‘activate_wp-postratings/wp-postratings.php’), WP_Hook->do_action, WP_Hook->apply_filters, ratings_activation, ratings_activate, dbDelta, referer: https://bags-of-books.co.uk/wp-admin/network/update.php?action=upload-plugin

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Lester Chan

    (@gamerz)

    Weird,

    Are you able to do a var_dump( $create_sql ) before https://github.com/lesterchan/wp-postratings/blob/master/includes/postratings-activation.php#L56 and see what is the SQL statement being printed?

    Thread Starter mattgivertz

    (@mattgivertz)

    I’m not a developer per se but do have some capability so please bear with me.

    Would this php file be in the wordpress plugin direcrectory? Also where would the output be placed? I’m not sure I know enough about how wordpress does stuff to do this without breaking anything

    Thread Starter mattgivertz

    (@mattgivertz)

    OK. I edited the php file on the WordPress plugins folder and added the statement. When activating I saw the following under the error message

    string(514) “CREATE TABLE wp_ratings (rating_id INT(11) NOT NULL auto_increment,rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT(2) NOT NULL ,rating_timestamp VARCHAR(15) NOT NULL ,rating_ip VARCHAR(40) NOT NULL ,rating_host VARCHAR(200) NOT NULL,rating_username VARCHAR(50) NOT NULL,rating_userid int(10) NOT NULL default ‘0’,PRIMARY KEY (rating_id),KEY rating_userid (rating_userid),KEY rating_postid_ip (rating_postid, rating_ip)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;”

    Plugin Author Lester Chan

    (@gamerz)

    Weird, I run the query, it works on, my end.

    What happens if you run it on phpmyadmin?

    CREATE TABLE wp_ratings (rating_id INT(11) NOT NULL auto_increment,rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT(2) NOT NULL ,rating_timestamp VARCHAR(15) NOT NULL ,rating_ip VARCHAR(40) NOT NULL ,rating_host VARCHAR(200) NOT NULL,rating_username VARCHAR(50) NOT NULL,rating_userid int(10) NOT NULL default '0',PRIMARY KEY (rating_id),KEY rating_userid (rating_userid),KEY rating_postid_ip (rating_postid, rating_ip)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

    Plugin Author Lester Chan

    (@gamerz)

    .

    • This reply was modified 4 years, 5 months ago by Lester Chan.
    Thread Starter mattgivertz

    (@mattgivertz)

    Sorry to be a plank here but how do I run this using phpmyadmin as I’m not familiar with this

    Plugin Author Lester Chan

    (@gamerz)

    Maybe ask your host where to get access it? Most host comes with it. I can’t really see what is wrong with the query as I run on my site and the table got created.

    Or the alternative, you can try another plugin =)

    • This reply was modified 4 years, 5 months ago by Lester Chan.
    Thread Starter mattgivertz

    (@mattgivertz)

    Just saw your email regards removing l68 so will try that first

    Thread Starter mattgivertz

    (@mattgivertz)

    Remarked out line 68 the alter table command and still got the error. Will try to manually create the table

    Thread Starter mattgivertz

    (@mattgivertz)

    OK.

    Used phpmyadmin to run the create table statement and it failed as the table was present so I dropped the table and tried to re-activate the plug-in again. It errored again ??

    I went into phpmyadmin and the table wp_ratings had been created. The error logged was as follows;

    [Wed Jun 03 09:48:00.327052 2020] [php7:notice] [pid 14692] [client 86.182.80.181:33400] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT’ at line 1 for query ALTER TABLE wp_ratings CHANGE COLUMN rating_id rating_id INT(11) NOT NULL auto_increment,rating_postid INT(11) NOT NULL ,rating_posttitle TEXT NOT NULL,rating_rating INT(2) NOT NULL ,rating_timestamp VARCHAR(15) NOT NULL ,rating_ip VARCHAR(40) NOT NULL ,rating_host VARCHAR(200) NOT NULL,rating_username VARCHAR(50) NOT NULL,rating_userid int(10) NOT NULL default ‘0’,PRIMARY KEY (rating_id),KEY rating_userid (rating_userid),KEY rating_postid_ip (rating_postid, rating_ip) /* From [bags-of-books.co.uk/wp-admin/plugins.php?action=error_scrape&plugin=wp-postratings%2Fwp-postratings.php&_wpnonce=37eda55765] in [/nas/content/live/bagsofbomaster/wp-content/plugins/wp-postratings/includes/postratings-activation.php:57] */ made by do_action(‘activate_wp-postratings/wp-postratings.php’), WP_Hook->do_action, WP_Hook->apply_filters, ratings_activation, ratings_activate, dbDelta, referer: https://bags-of-books.co.uk/wp-admin/network/plugins.php?plugin=wp-postratings%2Fwp-postratings.php

    Thread Starter mattgivertz

    (@mattgivertz)

    I’ve generated the SQL for the wp_ratings from myphpadmin and from what I can see it looks like it’s per the create statement

    — Host: pod-101274.wpengine.com:13306
    — Generation Time: Jun 03, 2020 at 09:59 AM
    — Server version: 5.7.29-32-log
    — PHP Version: 7.2.24-0ubuntu0.18.04.4

    SET SQL_MODE = “NO_AUTO_VALUE_ON_ZERO”;
    SET AUTOCOMMIT = 0;
    START TRANSACTION;
    SET time_zone = “+00:00”;

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8mb4 */;


    — Database: wp_bagsofbomaster

    — ——————————————————–


    — Table structure for table wp_ratings

    CREATE TABLE wp_ratings (
    rating_id int(11) NOT NULL,
    rating_postid int(11) NOT NULL,
    rating_posttitle text COLLATE utf8mb4_unicode_520_ci NOT NULL,
    rating_rating int(2) NOT NULL,
    rating_timestamp varchar(15) COLLATE utf8mb4_unicode_520_ci NOT NULL,
    rating_ip varchar(40) COLLATE utf8mb4_unicode_520_ci NOT NULL,
    rating_host varchar(200) COLLATE utf8mb4_unicode_520_ci NOT NULL,
    rating_username varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL,
    rating_userid int(10) NOT NULL DEFAULT ‘0’
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;


    — Indexes for dumped tables


    — Indexes for table wp_ratings

    ALTER TABLE wp_ratings
    ADD PRIMARY KEY (rating_id),
    ADD KEY rating_userid (rating_userid),
    ADD KEY rating_postid_ip (rating_postid,rating_ip);


    — AUTO_INCREMENT for dumped tables


    — AUTO_INCREMENT for table wp_ratings

    ALTER TABLE wp_ratings
    MODIFY rating_id int(11) NOT NULL AUTO_INCREMENT;
    COMMIT;

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

    Plugin Author Lester Chan

    (@gamerz)

    Oh I know why, because you are using network activation? It doesn’t support it. You need to activate per site.

    Thread Starter mattgivertz

    (@mattgivertz)

    OK. I got to the point where I removed all table actions leaving only add options and still errored. Went into site and activated OK. Options etc all there. You may want to update your installation instructions ?? ??

    Thanks for the assist

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[NSFW] Installation Error’ is closed to new replies.