My Fix for install failure with "install-functions.php on line 511"
If you have received an error during installation similar to this:
"string(184) "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 'Type=MyISAM DEFAULT CHARACTER SET UTF8' at line 6" string(184) "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 'Type=MyISAM DEFAULT CHARACTER SET UTF8' at line 8" string(226) "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 '(14) NOT NULL, `date_submitted` timestamp(14) NOT NULL, `EXIF_date_taken` varc' at line 7" string(185) "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 'Type=MyISAM DEFAULT CHARACTER SET UTF8' at line 12" string(185) "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 'Type=MyISAM DEFAULT CHARACTER SET UTF8' at line 29" string(184) "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 'Type=MyISAM DEFAULT CHARACTER SET UTF8' at line 6" Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /xxx/http/xxx/xxx.com/xxx/plog-admin/includes/install-functions.php on line 511"
The important part is this:
"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 'Type=MyISAM DEFAULT CHARACTER SET UTF8'"
It means that, in this case, "Type=MyISAM" is invalid. This is because either your version of MySQL or it's configuration does not recognise the statement. Here's how to fix it:
ATTENTION: To avoid frustration, read all of the steps before trying this
1. make a backup copy of /plog-admin/includes/install-functions.php in case something goes wrong
2. open install-functions.php in a decent editor (NOT notepad; on windows, wordpad is necessary unless you have something better)
3. Find the section called "function create_tables()". All of the database tables are created here. Notice the "Type=MyISAM" statement at the end of each table declaration. There are 8 of them (only 6 are created by default)
4. Replace "Type=MyISAM" with "Engine=MyISAM" (without the double quotes) in all 8 declarations and save the file
5. Copy the new install-functions.php file to /plog-admin/includes/ on your site using FTP
6. Use something like phpMyAdmin to check your database... it should be empty, but if there are any tables in it, drop them all.
7. Delete /plog-config.php from your site and re-run the installation script again.
8. You might or might not now get a different error like this one:
"string(226) "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 '(14) NOT NULL, `date_submitted` timestamp(14) NOT NULL, `EXIF_date_taken` va' at line 7"". EVEN THOUGH IT WILL SAY THAT PLOGGER IS INSTALLED SUCCESSFULLY I WOULD NOT USE IT UNTIL INSTALL HAS NO ERRORS.
The issue with this error is the data type declaration of "timestamp(14)". The field length is implicit for this data type so we need to remove the "(14)".
9. Re-edit your new install-functions.php, again in the "function create_tables()" section. In the third declaration, the one that creates the "pictures" table, you will see two instances of "timestamp(14)". Change these to "timestamp" and save the file.
10. Repeat steps 5, 6 and 7 and now Plogger should install without these errors.
Of course, you can do steps 3, 4 and 8 all together, but I would only make changes to fix things.
Is there any chanche to apply this fix to an already installed plogger? I have upgraded from a previous version and I have already some gallerys published so I cannot start a new installation or wipe the database.