Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error PDOStatement: Invalid default value for 'updatetime' #723

Closed
shaneonabike opened this issue Dec 14, 2015 · 8 comments
Closed

Error PDOStatement: Invalid default value for 'updatetime' #723

shaneonabike opened this issue Dec 14, 2015 · 8 comments

Comments

@shaneonabike
Copy link

Hey there!

On a fresh install I seem to be receiving the following error from the log file.

Error PDOStatement: Invalid default value for 'updatetime'

Here's a copy of my config (I'm using mysql)

[globals]
db_type=mysql
db_host=localhost
db_file=data/sqlite/selfoss.db
db_database=selfoss
db_username=dbuser
db_password=dbpass
db_port=3306
db_prefix=
logger_level=DEBUG
items_perpage=50
items_lifetime=30
base_url=
username=
password=
;username=myuser
;password=blah
b35b776358d
salt=salty
public=
html_title=beesonabike
rss_title=beesonabike feed
rss_max_items=300
rss_mark_as_read=0
homepage=newest
language=0
auto_mark_as_read=0
auto_stream_more=1
anonymizer=
use_system_font=
readability=
share=gtfprde
wallabag=
allow_public_update_access=
unread_order=
load_images_on_mobile=0
auto_hide_read_on_mobile=0
env_prefix=selfoss_

Is there something wrong with all of this?

@niol
Copy link
Collaborator

niol commented Dec 15, 2015

What is your version of mysql? The syntax used in selfoss works only with mysql >=5.6.

Simple workaround, as default value use useless because of the trigger declared later in the same file:

--- a/daos/mysql/Database.php
+++ b/daos/mysql/Database.php
@@ -56,7 +56,7 @@ class Database {
                         source INT NOT NULL ,
                         uid VARCHAR(255) NOT NULL,
                         link TEXT NOT NULL,
-                        updatetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+                        updatetime DATETIME NOT NULL,
                         author VARCHAR(255),
                         INDEX (source)
                     ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

@shaneonabike
Copy link
Author

Ahhh this worked perfectly thank you! I am within the correct version of mysql though

@seyfro
Copy link

seyfro commented May 13, 2016

Hi,

first thanks for creating a self-hosted & opensource RSS solution - I was using tt-rss for years - anyway as their support is really rude and actually offensive, I decided to look for an alternative and found selfoss.

I had the same issue (running mySQL 5.5) as described above when trying to install selfoss - after changing the file Database.php as proposed, I could run selfoss & the following mySQL-tables are created:

  • selfoss_items
  • selfoss_sources
  • selfoss_tags
  • selfoss_version

Anyway if I try to e.g. access the settings, I see the following error on frontend:

Load list error: error Internal Server Error

If I have a look into the PHP error log, I see the following entries:

[Fri May 13 16:21:48 2016] [warn] mod_fcgid: stderr: PDOStatement: Table 'databasename.version' doesn't exist
[Fri May 13 16:21:50 2016] [warn] mod_fcgid: stderr: PDOStatement: Duplicate column name 'shared'

It seems that somehow the prefix I set with db_prefix=selfoss_ in config.ini is not considered anymore after installation. After reloading the frontend with F5, the interface is even not visible anymore - instead "an error occured" is shown and PHP logs shows again

[Fri May 13 16:24:50 2016] [warn] mod_fcgid: stderr: PDOStatement: Duplicate column name 'shared'

Is this a known bug?

@jtojnar
Copy link
Member

jtojnar commented May 13, 2016

@robertharm Sometimes we forget to add the prefix when we change the code and as not many people use the db_prefix option it often goes unnoticed. Could you try the latest development version? It should be fixed there #755

@seyfro
Copy link

seyfro commented May 13, 2016

@jtojnar thanks - using the development version fixed the issue. Anyway it would be great if the different SQL create statement for mySQL<5.6 would be used automatically, so that the change above does not need to be applied on each update (I talked to my hoster, but upgrading to mySQL 5.6 is not on the nearer roadmap yet unfortunately).

@jtojnar
Copy link
Member

jtojnar commented Feb 5, 2017

Is this still relevant? LTS Debian does not support MySQL < 5.6.

@rwky
Copy link

rwky commented Feb 5, 2017

CentOS7 uses MariaDB 5.5.

@jtojnar
Copy link
Member

jtojnar commented Feb 5, 2017

Fixed in #863

@jtojnar jtojnar closed this as completed Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants