OJS 3 theme is not working in PHP 7

Hi Jason!

Update: The default theme is no longer working.

Do you know if this issue have been fixed in OJS

Hi @daniel.anez

The default theme should definitely work in It’s part of the OJS core. I’d try clearing caches first, and looking in your error logs for detailed PHP problems. When you jumped to did you also increase your PHP version? requires PHP7.2. Older versions of OJS got by with PHP5.6.


Hi Jason!

Yes, we’re running the dev site with PHP 7.2, the default theme is running fine since I change de Plugin.inc.php to the one you have on your git.

The problem are the other themes, none of theme is working and the Smarty Doc is not public, so we’re searching for others solutions.

For example, the OJS themes that I found on a thread here in the forum doesn’t work and we don’t know why.

I’ve deleted the caches but that doesn’t solve the problem.

Hi @daniel.anez

Off the top of my head, the main thing that broke in older themes when Smarty was updated to version 3 were places where the template included embedded PHP code, like




Those needed to be changed to the Smarty equivalents, like {break} and {continue}.

This sort of thing would show up in the PHP error log, though. Anything in there at all?


Hi @jnugent

Happy new year!

I’m reviewing the code but in the error logs there’s no error related to PHP, just warnings like

AH01071: Got error 'PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/test.summapsicologica.cl/httpdocs/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 1581\n

PHP message: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/test.summapsicologica.cl/httpdocs/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 1581\n', referer: http://test.summapsicologica.cl/index.php/summatest/login

Hey @daniel.anez

If you’re getting unstyled content, but not blank pages, PHP isn’t generating fatal errors, so it’s probably the theme itself, not being loaded. Out of curiosity, what version of OJS are you using?


Hi @jnugent

We’re using OJS 3.1.2.

The only theme that works is the default theme. There’s no other theme working on the devsite (in which we’re working). The devsite is running in Plesk with PHP 7.2.

Which version of 3.1.2, though? 3.1.2 came out nearly a year ago, and there have been point releases for it as recent as just a few weeks ago. Lots of bug fixes since the first version :slight_smile:

And also, how exactly are you installing themes?


Hello @jnugent

I was trying to login to te site but I can’t. The user and pass are both correct (change the pass througt email) and the problem remains, I can’t acces to the admin dashboard.

We haven’t done any change on the code.

We have OJS and I’m dowloading the themes, loading into the /plugins/theme folder, unzip it and then selecting them within the admin dashboard.

This is the error that shows the logs

AH01071: Got error 'PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/test.summapsicologica.cl/httpdocs/cache/t_compile/65bfc3e024c2e9104f46e23b73376a9455e3df0e^51cfb9321c891ada9323e7942962579e7e4324d1_0.app.frontendpagesindexSite.tp.php on line 43\n', referer: http://test.summapsicologica.cl/index.php/index/login

Okay, that may be helpful. The best way to install a theme is through the plugin gallery. If you’re just unzipping them in the plugin/themes folder they may not be recognized by OJS. There’s also a CLI tool that you can run:

php lib/pkp/tools/installPluginVersion.xml plugins/themes/yourtheme/version.xml

that will also install it. It sounds like they aren’t installed (thank @asmecher for the idea)


But what if we are developing a theme for a client? What would be the best way to install it?

I tried installing a theme througt the plugin gallery (the classic theme) and the problem remains.
There’s no style at all.

You’d use the CLI tool in that case.

At this point I would recommend upgrading to 3.1.2-4 to make sure you have all of the latest bug fixes, and try the theme installation again.

Hi, @jnugent, thanks for the help.

Ok, I will install a newer version of OJS.

I’ll comment here the results.

Hu @daniel.anez,

Currently, my test instance of OJS 3.1.2-1 has several official themes installed:

  • Classic v.
  • Health Sciences v.
  • Immersion

These are the latest ones available.
Unfortunately, I can’t reproduce the problem that you describe; tested with PHP 7.2.26-1.

  1. Can you double-check if permission for OJS are set accordingly, e.g., for cache folder? And secondly, can you confirm that cache is refreshed after changing the theme?
  2. Can you reproduce this problem on a fresh OJS instance?

Hello, @Vitaliy

  1. How can I check the OJS permissions?

  2. I currently asking for authorization to install a new OJS instance running OJS

If you could explain to me how I can check the permissions, I would give that answer tonight.

Hi @daniel.anez,

Regarding permissions: How should file permissions be set? - #2 by ctgraham
Described symptoms may occur if cache isn’t renewed after theme change.

If it’s not a cause of the problem, you can test OJS on your local machine. I’d make a copy of the site, database and files folder and installed it locally. If it’s reproducible, the next step is debugging locally, if not - the problem is probably in the server environment.