Urgent: Error after installing OHS

I made the installation of OHS successfully, but when I enter, the following error


DB Error: ERROR: column “enabled” does not exist LINE 4: AND ps.setting_name = “enabled” ^
Stack Trace:
File: /var/www/html/ohsuis/lib/pkp/classes/site/VersionDAO.inc.php line 228
Function: DAO->retrieve(“SELECT v.* FROM versions v LEFT JOIN plugin_settings ps ON …”, Array(0), False)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 257
Function: VersionDAO->getCurrentProducts(Array(0))

File: /var/www/html/ohsuis/lib/pkp/classes/plugins/PluginRegistry.inc.php line 98
Function: PKPApplication->getEnabledProducts(“plugins.generic”)

File: /var/www/html/ohsuis/lib/pkp/classes/core/Dispatcher.inc.php line 126
Function: PluginRegistry->loadCategory(“generic”, True)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 176
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/html/ohsuis/index.php line 65
Function: PKPApplication->execute()


The server configuration is

-Redhat Enterprise Linux 7
-PHP 5.4.16 (cli)
-Apache versión 2.4.6
-Versión 9.2.23 de PostgreSQL

What can be the solution?

Thank you
David.

Hi @drueda,

What version of OHS are you using? Did you download the .tar.gz file from the PKP website, or use github, or get it from somewhere else?

Regards,
Alec Smecher
Public Knowledge Project Team

best regard @asmecher

The file was downloaded from: https://pkp.sfu.ca/ohs/ohs_download/

The OHS version is: ohs-2.3.2.tar.gz

Thank you
David.

Hi @drueda,

What do you see around line 228 of lib/pkp/classes/site/VersionDAO.inc.php?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

line 228 corresponds to:
WHERE current = 1 AND (ps.setting_value OR NOT v.lazy_load)’, $context, false);

see the image
VersionDAO

Thank you
David.

Hi @drueda,

That’s not the same as the ohs-2.3.2.tar.gz file should contain – are you sure this is the version from that file?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

yes sir, I’m sure.

Route. ohs-2.3.2\lib\pkp\classes\site

File: VersionDAO.inc

Line 228: WHERE current = 1 AND (ps.setting_value OR NOT v.lazy_load)’, $context, false);

Downloaded from: https://pkp.sfu.ca/harvester2/download/ohs-2.3.2.tar.gz

Thank you
David.

Hi @drueda,

Ah, I see my local copy is a little newer than the released package. Try replacing line 227:

 AND ps.setting_name = "enabled" '.$contextWhereClause.'

…with…

AND ps.setting_name = \'enabled\' '.$contextWhereClause.'

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I already made the line change, but now the following error is displayed

DB Error: ERROR: argument of NOT must be type boolean, not type smallint LINE 5: … WHERE current = 1 AND (ps.setting_value OR NOT v.lazy_loa… ^
Stack Trace:
File: /var/www/html/ohsuis/lib/pkp/classes/site/VersionDAO.inc.php line 228
Function: DAO->retrieve(“SELECT v.* FROM versions v LEFT JOIN plugin_settings ps ON …”, Array(0), False)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 257
Function: VersionDAO->getCurrentProducts(Array(0))

File: /var/www/html/ohsuis/lib/pkp/classes/plugins/PluginRegistry.inc.php line 98
Function: PKPApplication->getEnabledProducts(“plugins.generic”)

File: /var/www/html/ohsuis/lib/pkp/classes/core/Dispatcher.inc.php line 126
Function: PluginRegistry->loadCategory(“generic”, True)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 176
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/html/ohsuis/index.php line 65
Function: PKPApplication->execute()

Thank you
David.

Hi @drueda,

It looks like your PostgreSQL is being very picky about its SQL. You can also change that line…

 WHERE current = 1 AND (ps.setting_value OR NOT v.lazy_load)', $context, false);

…to…

 WHERE current = 1 AND (ps.setting_value=1 OR v.lazy_load=0)', $context, false);

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I already made the line change, but now the following error is displayed

DB Error: ERROR: operator does not exist: text = integer LINE 5: WHERE current = 1 AND (ps.setting_value=1 OR v.lazy_loa… ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Stack Trace:
File: /var/www/html/ohsuis/lib/pkp/classes/site/VersionDAO.inc.php line 228
Function: DAO->retrieve(“SELECT v.* FROM versions v LEFT JOIN plugin_settings ps ON …”, Array(0), False)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 257
Function: VersionDAO->getCurrentProducts(Array(0))

File: /var/www/html/ohsuis/lib/pkp/classes/plugins/PluginRegistry.inc.php line 98
Function: PKPApplication->getEnabledProducts(“plugins.generic”)

File: /var/www/html/ohsuis/lib/pkp/classes/core/Dispatcher.inc.php line 126
Function: PluginRegistry->loadCategory(“generic”, True)

File: /var/www/html/ohsuis/lib/pkp/classes/core/PKPApplication.inc.php line 176
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/html/ohsuis/index.php line 65
Function: PKPApplication->execute()

Thank you
David.

Hi @drueda,

Hmm, your PostgreSQL is being extremely picky – I wonder if you’re not using an especially pedantic version of it? You may need to quote the 1, i.e. ps.setting_value='1'. If you have some SQL skills, please experiment with this further – it’s slow and error-prone for me to do so remotely :slight_smile:

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I made the change, but it did not work

When I change from 1 to ‘1’, the page goes down,

Which other configuration do you recommend?

Thank you
David

Hi @drueda,

In PHP, if you’re inside a string quoted by ' characters, you’ll need to escape 's inside it with a backslash. You probably have a syntax error.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I was validating and the sintaxys is fine.

I was also reviewing postgres and I found this:
https://ma.support.signiant.com/customer/portal/articles/1935871-custom-solution-error-operator-does-not-exist-numeric-text?b_id=5379
"This issue occurs because PostgreSQL 9.0 does not automatically cast non-character data types to TEXT. Signiant 9.2 has been upgraded to use PostgreSQL 9.0 compared to PostgreSQL 8.1 used in earlier versions. "

What do you think? Could this be?

Thank you
David.

Hi @drueda,

Yes, I think this is the cause, so you’d need to make sure to quote numbers compared against strings in your PHP.

When the page “goes down”, do you see anything relevant in your PHP error log?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

There is no error.

Thank you
David.

Hi @drueda,

Can you say what specifically happens when the site “goes down”?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

After saving the change, I try to access the URL and it presents the STATUS 500 error, and I restore the change in the file VersionDAO.inc, and I make the modification ‘1’ to 1, it works again.

Thak you
David.

Hi @drueda,

That should definitely result in something being captured in the error log.

Regards,
Alec Smecher
Public Knowledge Project Team