Moving upgraded OJS 3 to new server

Hi PKP folks,

I’m working on moving an OJS 3 upgrade (which works on my localhost) to a new server, and am getting the following error message in my PHP error log. Is this telling me something’s wrong with the PHP installation, or that I need to install pear? Or is it a permissions issue? When I try to access from the web, I get a 500 error.

Any help is appreciated! The server is running PHP 5.6.

PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
PHP Fatal error: Unknown: Failed opening required ‘/var/www/html/guelph/index.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in Unknown on line 0

Hi @kaitlin

When exactly do you get those errors? I do not know what are your steps (what have you done), but maybe to go step by step, e.g. first to see that the apache2 and your domain is working correctly, than a simple php page, than maybe a clean/new ojs, etc…
pear is not needed, I think… permissions could be, but… as I said, best to go step by step…

Best,
Bozana

Thanks Bozana. I’ll try doing a clean OJS install on the server and see if that works. Creating a basic php page works on the server.

So it looks like my original issue was a problem with SELinux, and I’m now getting a different error in my log:

PHP Fatal error:  Call to a member function getPrimaryLocale() on null in /var/www/html/guelph/classes/i18n/AppLocale.inc.php on line 108

I created a new empty OJS instance on the same server and it worked, so that doesn’t appear to be the issue. I also tested the mysqli connection, as noted in another forum post, and that was connecting fine. Any thoughts on what could be causing this?

Hi @kaitlin,

It sounds to me like there are no entries in your site table – if this is an upgraded installation, are you sure it upgraded successfully? If it’s a new install, is it possible that the installation didn’t complete?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

The upgraded version worked fine on my local machine, but I’ve been running into problems since moving it to the server.

I’m having a look at the site table, and can see one entry - here it is as JSON:

{
	"data":
	[
		{
			"min_password_length": 6,
			"primary_locale": "en_US",
			"installed_locales": "en_US:fr_CA",
			"supported_locales": "en_US:fr_CA",
			"original_style_file_name": null,
			"redirect": 0
		}
	]
}

Hi @kaitlin,

Hmm, it’s possible that your cache files are causing trouble. Try manually erasing all .php files from cache/ to see if they get recreated by OJS as you use it.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, unfortunately this didn’t seem to resolve it either, and I’m continuing to get the getPrimaryLocale() fatal error in my PHP log.

Hi @kaitlin,

Are cache files getting recreated in cache/? Do you see e.g. a cache/fc-siteSettings-site.php file there?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, I’m not seeing any cache files getting recreated

Hi @kaitlin,

OK, this suggests you’ll need to work with file permissions. Check the README document, and in this forum there’s a FAQ entry on permissions too. Once you have permissions set correctly, you should be able to delete cache/*.php and see PHP files get re-generated there as you access the site. (If you see that, it’s not a clear indication that you have permissions set correctly – but it’s a good sign.)

Regards,
Alec Smecher
Public Knowledge Project Team

I wanted to follow up in case anyone else has this issue!

The problem was that our database cluster didn’t support MyISAM storage, so it needed to be converted to innoDB. Once we fixed that, it resolved these problems.

Hi everyone

I have got the same errors:

[Wed Mar 20 15:08:28.527034 2019] [:error] [pid 16030] [client 192.168.0.1:55336] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Mar 20 15:08:28.527087 2019] [:error] [pid 16030] [client 192.168.0.1:55336] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/ffyl_ojs3114/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

And these errors are resulted by SELinux is enabled in my Centos 7 Server. So I left the commands that I have used to resolve this problem:

#Changing ownership to ojs directory

sudo chown -R apache:apache /var/www/html/ojs_directory

#SELinux serves files through Apache in Recursive way

sudo chcon -t httpd_sys_content_t /var/www/html/ojs_directory -R

#Writtable directories

sudo chmod -R 777 /var/www/html/ojs_directory/cache
sudo chmod -R 777 /var/www/html/ojs_directory/public
sudo chmod -R 777 /var/www/html/ojs_directory/config.inc.php

#SELinux allows writtable specific directories

sudo chcon -t httpd_sys_rw_content_t /var/www/html/ojs_directory/cache -R
sudo chcon -t httpd_sys_rw_content_t /var/www/html/ojs_directory/public -R
sudo chcon -t httpd_sys_rw_content_t /var/www/html/ojs_directory/config.ing.php -R

I hope this could be to help for someone.

Best Regards