I can not preview or download pdf files after moving to windows server

hi again :relieved:
i have problem help me please

i move ojs folder with db from Linux server to dedicated server with windows server 2016

i change files_dir = “C:/wamp64/www/ojs”

So i want to change permission to 755 but Apache already has all the permissions it needs, as it runs under the LocalSystem account on Windows, which has extensive read/write access to local paths. This is inherited by PHP and the scripts it runs.

i can’t preview pdf or download it
please help me
what can i do?

Hi @fadia,

I’m not especially familiar with Windows’s permissions model – but I would suggest checking whether those permissions are sufficient by writing a quick test script containing e.g.:

<?php echo is_readable('/path/to/some-file.pdf')?'readable':'not readable'; ?>

Replace the path in ' quotes with the complete path to any file within your files directory. Then execute the script via your browser to see whether the files is readable. If not, you’ll likely need to work with file permissions.

Regards,
Alec Smecher
Public Knowledge Project Team

hi
i don’t know path of file pdf the pdf store as xml :sweat_smile:
in files_dir is “C:/wamp64/www/ojs”
so i wrote

<?php echo is_readable('C:/wamp64/www/ojs/4.pdf')?'readable':'not readable'; ?>

or take it from url

<?php echo is_readable('https://www.ust.edu/ojs/index.php/AJQAH/article/download/1103/1106/4.pdf')?'readable':'not readable'; ?>

it’s true ?

Hi @fadia,

It appears that your files directory is a subdirectory of your OJS installation. Beware that this is a dangerous configuration, unless you’ve protected its contents from direct access via e.g. a .htaccess file. See docs/README in the “Recommended Configuration” section. This is also noted e.g. on the installation form.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi
I discover that there are folder in the root of old server contain the files of OJS
I can’t access to the old hosting to copy the folder from the root, Is there any way to re generate that folder and uploads the pdf or docs in it
please help me
:persevere:

any body here

i mean … i want create folder for files and put in it all old files pdf or docs
i want know structure store files in the folder

:pray:

Hi @fadia,

The best way to find out what directories OJS expects to find files in is probably to modify the files code temporarily to get it to log pathnames. Guiding you through that is a little out of scope for this forum, but you can start by editing lib/pkp/classes/file/FileManager.inc.php and adding to the start of the readFileFromPath function:

error_log('TRYING TO ACCESS FILE: ' . $filePath);

Whenever OJS tries to access a file, the path should be recorded in the PHP log file.

Regards,
Alec Smecher
Public Knowledge Project Team