Issues installing OJS v3.2.1-1

I’m installing OJS v3.2.1-1 on an AWS Ubuntu 18 base image, and I can’t reach either the browser-based or the command-line installation portion.
I’m using the documentation found here: https://pkp.sfu.ca/ojs/README.

The supporting packages are installed as follows:

  1. Apache: apt-get install -y apache2
    root@ojs-dev:~# apache2 -v
    Server version: Apache/2.4.29 (Ubuntu)

  2. php: apt-get install -y php
    root@ojs-dev:~# php -v
    PHP 7.2.24-0ubuntu0.18.04.6 (cli) (built: May 26 2020 13:09:11) ( NTS )

  3. mysql: apt-get install -y mysql
    root@ojs-dev:~# mysql -V
    mysql Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using EditLine wrapper

Initial configuration steps are as follows:

  1. Unpack & place OJS files (## Installation, Step 1)

    • tar -xf /root/stage/ojs-3.2.1-1.tar.gz -C /var/www/html
  2. Change the directory name from ojs-3.2.1-1 to ojs (## Installation, Step 1)

    • mv /var/www/html/ojs-3.2.1-1 /var/www/html/ojs
  3. Recursively change ownership of the OJS app directory (## Installation, Step 2)

    • chown -R root:root /var/www/html/ojs
  4. Make config.inc.php executable (## Installation, Step 2)

    • chmod 755 /var/www/html/ojs/config.inc.php
  5. Make ‘public’ and its contents executable (## Installation, Step 2)

    • chmod 755 -R /var/www/html/ojs/public
  6. Make ‘cache’ and its contents executable (## Installation, Step 2)

    • chmod 755 -R /var/www/html/ojs/cache
  7. Create /opt/ojs to store uploaded files (## Installation, Step 3)

    • mkdir -p /opt/ojs
  8. Recursively change ownership of the OJS uploads directory (## Installation, Step 3)

    • chown -R root:root /opt/ojs
  9. Make the main OJS app directory executable (I get a “Forbidden” error otherwise)

    • chmod 755 /var/www/html/ojs

Attempting to access the on-screen installation instructions at http://<my_ip_address>/path/to/ojs/ (## Installation, Step 4), I get a blank page. As a test, I made a backup copy of the original /var/www/html/ojs/index.php file and replaced the contents with a basic “Hello World” test page, which came up just fine.

Attempting to use the CLI installer, running ‘php tools/install.php’ from /var/www/html/ojs, I get this error:

root@ojs-dev:/var/www/html/ojs# php tools/install.php
PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create() in /var/www/html/ojs/lib/pkp/classes/xml/XMLParser.inc.php:223
Stack trace:
#0 /var/www/html/ojs/lib/pkp/classes/xml/XMLParser.inc.php(171): XMLParser->createParser()
#1 /var/www/html/ojs/lib/pkp/classes/xml/XMLParser.inc.php(215): XMLParser->parseTextStruct(’<?xml version="…’, Array)
#2 /var/www/html/ojs/lib/pkp/classes/db/XMLDAO.inc.php(52): XMLParser->parseStruct(‘lib/pkp/registr…’, Array)
#3 /var/www/html/ojs/lib/pkp/classes/i18n/TimeZoneDAO.inc.php(58): XMLDAO->parseStruct(‘lib/pkp/registr…’, Array)
#4 /var/www/html/ojs/lib/pkp/classes/cache/GenericCache.inc.php(63): TimeZoneDAO->_timeZoneCacheMiss(Object(FileCache), NULL)
#5 /var/www/html/ojs/lib/pkp/classes/cache/FileCache.inc.php(115): GenericCache->get(NULL)
#6 /var/www/html/ojs/lib/pkp/classes/i18n/TimeZoneDAO.inc.php(77): FileCache->getContents()
#7 /var/www/html/ojs/lib/pkp/classes/i18n/PKPLocale.inc.php(738): TimeZoneDAO->getTimeZones()
#8 /var/www/html/ojs/lib/pkp/classes/i18n/ in /var/www/html/ojs/lib/pkp/classes/xml/XMLParser.inc.php on line 223

Is there some package, or step(s), that I might be missing which would account for what I’m experiencing?

Hi @cbirmingham,

Your PHP installation is missing XML support. On most distributions it’s in the php-xml package.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

Indeed, adding “apt-get install -y php-xml” to the above list of referenced commands got me past my initial hurdle. I can now get the OJS CLI configuration script to run.

However, for the web configuration portion, there still seems to be something out of sorts.

In the interest of being thorough, it’d be nice to get the web-configuration issue solved. However, if the CLI configuration isn’t compromised by this issue, I’ll make use of that method.

Thanks again,
C. Birmingham II

Hi @cbirmingham,

Double-check the file permissions in your cache directory – OJS doesn’t have permission to write there. I’d also recommend setting your PHP errors/warnings to be directed to the log, rather than the browser, so they don’t interfere with AJAX requests. (This is recommended for production use anyway.)

Regards,
Alec Smecher
Public Knowledge Project Team

HI Alec,

Based on your feedback regarding permissions, I’ve made the following adjustments to my pre-config steps 4. 5. & 6.:
chmod 664 /var/www/html/ojs/config.inc.php
chmod 776 -R /var/www/html/ojs/public
chmod 776 -R /var/www/html/ojs/cache

These were the least-permissive settings I could use that would dispel the web-config errors I was seeing.

Checking back withing ojs/cache, I now see several app-generated fc-locale-…php files, so that seems reassuring. Since those app-generated files had www-data as the user/group owner, I deleted/rebuilt the entire system and also changed my pre-config step 3. to ‘chown -R root:www-data /var/www/html/ojs’.

I try to pull up the web-config page now, instead of seeing those previous errors, or any OJS config instructions, I get only a blank page. The CLI app-config bit still works fine.

Could there be some other file/directory permission change that I’ve missed? Also, can you provide a link to the PKP documentation for rerouting those PHP error messages? I’d like to ensure that the build steps for this new system are as cited/referenced as they are repeatable.

Thanks again,
Chuck Birmingham II

Hi @cbirmingham,

776 permissions shouldn’t be necessary (and aren’t very safe). Your system appears to be using mod_php for Apache, which runs PHP scripts under the www-data user. You should be able to chown all files OJS needs to write to www-data, then use e.g. 755 permissions.

When encountering a blank page, check your PHP and/or Apache error log for details.

To control where errors are sent, check the display_errors setting, both in OJS’s config.inc.php file and your php.ini PHP configuration.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

Based on your recommendations, I went with these steps after the basic package install covered earlier in our discussion:

  1. Stop apache
    systemctl stop apache2

  2. Unpack OJS
    tar -xf /root/stage/ojs-3.2.1-1.tar.gz -C /var/www/html

  3. Rename the OJS directory
    mv /var/www/html/ojs-3.2.1-1 /var/www/html/ojs

  4. Change owner for directory & contents
    chown -R www-data:www-data /var/www/html/ojs

  5. Change permissions for config.inc.php
    chmod 664 /var/www/html/ojs/config.inc.php

  6. Change permissions for the ojs/public & ojs/cache directories & contents
    chmod 755 -R /var/www/html/ojs/public
    chmod 755 -R /var/www/html/ojs/cache

  7. Create an file upload directory
    mkdir -p /opt/ojs

  8. Change owner for directory & contents
    chown -R www-data:www-data /opt/ojs

  9. Change permissions for directory & contents
    chmod 664 -R /opt/ojs

  10. Macke a backup copy of config.inc.php
    cp /var/www/html/ojs/config.inc.php /var/www/html/ojs/config.inc.php.orig

  11. Edit config.inc.php to reflect the domain URL
    vi /var/www/html/ojs/config.inc.php

  1. Start apache
    systemctl start apache2

Once apache has started and I try to hit the base URL, I get this message in /var/log/apache2/error.log:

Could this be a matter of more file/directory permission adjustments to be done?

Hi @cbirmingham,

I think your PHP installation is missing mbstring support.

Regards,
Alec Smecher
Public Knowledge Project Team

Alright. I’ll toss php-mbstring into the mix and see what’s what.

OK, Alec. Adding php-mbstring has sorted out the issue of getting the web-config interface to appear. So that bit appears settled.

The only thing remaining is that I’m still getting a similar apache error to the one in the above screenshot.

Could there be some other missing php package at play here?

Hi @asmecher,

I figured maybe this setup was still having issues due to not having installed the php-mysql package, so I installed it, and got the same error. Do I maybe need to create a database user before I go through the OJS setup process? Can you think of anything else I could have overlooked or mis-configured that would cause this response?

Thanks,
C. Birmingham II

Hi @cbirmingham,

As per your other thread, use the MySQLi driver rather than MySQL.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

OK… Having used the MySQLi driver, and then created the database & user in advance to avoid those subsequent errors, I’ve reached what I hope is my final basic installation issue. I’m getting the error: “The directory specified for uploaded files does not exist or is not writable.”

The first directory I tried was /opt/ojs. I changed its owner to www-data & set its permissions to 664. When that didn’t work, I figured that maybe OJS was unhappy with /opt still being owned by root. So I created /opt2/ojs and made sure all of it was owned by www-data with 664 permissions. Still no luck.

Any recommendations? Does hitting the [Install Open Journal Systems] button on the web interface maybe not make a fresh attempt?

Hi @cbirmingham,

The check on that directory just looks to see if it’s writable from within PHP. You can try it outside of the OJS context with a short test script:

<?php
$path = '/path/to/files-area';
 if (is_writable($path) && is_dir($path)) echo 'yes';
else echo 'no';

If you’re installing via the web browser, make sure to invoke this script the same way. If you get a yes, then OJS should be satisfied as well.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Thanks for this code snippet. I tested this script against /opt/ojs after setting directory permissions to 544, and got the ‘no’ I was expecting. Then I set directory permissions back to 664 and got a ‘yes’. However, the web-installer is still convinced that there’s an issue with this directory.

From here, I can only figure that there may be something amiss with the web installer. So, I’m going to attempt the command-line route and hope that I don’t run into the same issue.

C. Birmingham II

Hi @cbirmingham,

Are you executing the test script through the command line or through the web?

Regards,
Alec Smecher
Public Knowledge Project Team

I executed it through the web. I just named it test.php & tossed it into /var/www/html.

Hi @cbirmingham,

Are the /opt/ojs / /opt2/ojs directories empty?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Yes. Both of those directories were empty at the time of testing.

As an update, running the command-line install with the same values was successful. There was this php warning in the installation output, but the process ultimately succeeded.

“PHP Notice: Only variables should be assigned by reference in /var/www/html/ojs/lib/pkp/classes/cliTool/InstallTool.inc.php on line 75”

Hi @cbirmingham,

That warning is cosmetic and can be ignored (or can be resolved by applying https://github.com/pkp/pkp-lib/commit/4c2e0e07fc542af6ebd8ef7cee2f666acbe57855 in lib/pkp).

Regards,
Alec Smecher
Public Knowledge Project Team