Moved OJS 3.o to new domain and server issue

Hello, I moved OJS 3.0 from local comp to the server with domain pointed to it. When I typed my domain in browser I have got the following error message:
There are no readable files in this directory tree. Are safe mode or open_basedir active?

I found out that there are the following warning messages:
Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/js/lib/jquery/plugins/validate/localization/messages_en_US.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 567

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/js/lib/jquery/plugins/validate/localization/messages_en.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 567

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/en_US.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 584

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/en.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 584
Please advise

PHP is trying to find these resources in your server’s root instead of in the webserver’s document root. These includes shouldn’t begin with a “/”.

Can you confirm this still occurs even if you are using OJS 3.0.1?

if I understood you well your suggestion is to do upgrade to 3.0.0.1 and check if the same error will happen again? Right?

Yes, that was my suggestion, but I fear this may still be an open bug:

I committed change that judgej suggested in his github post, but I have got the same result.
One clarification:
I have put in config.inc.php the following paths as suggested by hosting company:
; The canonical URL to the OJS installation (excluding the trailing slash)
base_url = “/var/sentora/hostdata/admin/public_html”
and
files_dir = “/var/sentora/hostdata/admin/ojsdata”
I experimented with changing those paths but without success.
If there is any advise at this stage please let me know.
I have done upgrade to 3.0.1 successfully. There were no previously mentioned warnings but I do still have the same problem.
Are there any workarounds?

Thanks

The base_url configuration should be a URL, such as http://www.mydomainname.com/ojs, not a file path. Try changing that to the public URL of your OJS installation.

I changed that, but I still have the same issue.
I guess that the main solution would be to put workaround as judgej mentioned in all necessary places in Templatemanager.
When I put this solution in line 567 everything was OK for that line, but there are other lines too that require intervention in code.
Do you have some patch for that?

Thanks

Yes, I think the real fix is to ensure that PKPReqeust::getBaseURL() always returns either an empty string or a “/” terminated string, and then ensure that other path constructions never start with a “/”.

There isn’t a real fix at this time, but if you can provide a little more information about your setup, it might help us create one.

Do you ever see this for anything other than the file /lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/en.js?

The messages that I pasted above in my post were the only messages that I received. I did not receive any other error messages like that.

These are only messages I received.
Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/js/lib/jquery/plugins/validate/localization/messages_en_US.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 568

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/js/lib/jquery/plugins/validate/localization/messages_en.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 568

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/en_US.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 585

Warning: file_exists(): open_basedir restriction in effect. File(/lib/pkp/lib/vendor/moxiecode/plupload/js/i18n/en.js) is not within the allowed path(s): (/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/) in /var/sentora/hostdata/admin/public_html/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 585

I can see them only when I put that in config.inc.php that OJS is not installed.
When I put that OJS is installed I see only error message:
There are no readable files in this directory tree. Are safe mode or open_basedir active?
That is all I can see at the moment.

I will help and test as much as I can.
For now I need only workaround to make this OJS instance usable. I am willing to install another instance and test thoroughly real fixes.

Thanks

Actually, issue is in lines 568 and 585. I Think that this should not be hard to make it useful at least and later on implement the real fix.

Thanks

Hello,
I added judgej corections to lines 568 and 585. I do not get warning messages but I still have the same error message
There are no readable files in this directory tree. Are safe mode or open_basedir active?

Any suggestion?

That message is likely coming from this call:
https://github.com/pkp/pkp-lib/blob/master/classes/file/FileManager.inc.php#L354

Can you turn on show_stacktrace in config.inc.php to give a little more context for what is calling this?

Please check this:

Ok. Those commands really need to be referencing the correct OJS files_dir path, whether absolute or relative.

What is your files_dir set to in config.inc.php?

files are located here:
/var/sentora/hostdata/admin/ojsdata
all of that is behind public_html
Should I try to omit /var or so since I do not see it.
I see only / which is admin as hosting company admins told me and I have been told that the full path is
/var/sentora/hostdata/admin/ojsdata
The same installation was perfectly visible in xampp on windows.

Please advise

Is the actual line in config.inc.php:
files_dir = /var/sentora/hostdata/admin/ojsdata ?

; Complete path to directory to store uploaded files
; (This directory should not be directly web-accessible)
; Windows users should use forward slashes
files_dir = “/var/sentora/hostdata/admin/ojsdata”

Permission for ojsdata is 775. Other folders are 777 behind public_html including public_html

I asked hosting company to check path and permissions. After they removed base dir restrictions OJS is visible.
So, keeping eye on base-dir is actually solution for this type of problem.

Thanks

Another option worth noting would be adding this specific directory to your open_basedir directive, as:
/var/sentora/hostdata/admin/public_html/:/var/sentora/temp/:/var/sentora/hostdata/admin/ojsdata/

This provides increased security for your files outside of OJS.