OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Problem in Uploading Files (Galley, Supp. Files)

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Problem in Uploading Files (Galley, Supp. Files)

Postby nevermind182004 » Thu Nov 15, 2012 8:42 pm

Good day,

I'm having a problem on uploading files (pdf's, html and such) and hope i can find some answers on what is going on with our system. Recently we moved our OJS site to a new server. The only problem that i was encountering right now is that when i tried to upload a pdf files as an 'Editor/Author'
it looks like it works normally but nothing is being uploaded. please see screenshot below:

This is the part where we upload galley files:
Image
In process of uploading pdfs: (even doc file, jpgs etc will not work even having 1kb file size only)
Image
Note that it was successfully upload, but not the file! When i clicked the View Proof, it will be a blank page
Image

For me to test on what is the problem occurring on our system, I've turned the debug=on in config.inc.php to Display an error message when something goes wrong.

display_errors = On

Upon doing the steps above and click upload, this message comes up (note: ive changed values for our dbase and file paths). i really don't know what it says.. :S


Code: Select all
dbase_name has produced an error Message: WARNING: move_uploaded_file(file/journals/61/articles/2008/public/2008-5118-1-PB.pdf) [function.move-uploaded-file]: failed to open stream: Permission denied In file: /home/xxxxx/public_html/lib/pkp/classes/file/FileManager.inc.php At line: 104 Stacktrace: Server info: OS: Linux PHP Version: 5.2.9 Apache Version: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 DB Driver: mysql DB server version: 5.1.65-cll

dbase_name has produced an error Message: WARNING: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpdQemxI' to 'file/journals/61/articles/2008/public/2008-5118-1-PB.pdf' In file: /home/xxxxx/public_html/lib/pkp/classes/file/FileManager.inc.php At line: 104 Stacktrace: Server info: OS: Linux PHP Version: 5.2.9 Apache Version: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 DB Driver: mysql DB server version: 5.1.65-cll

dbase_name has produced an error Message: WARNING: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/lib/pkp/classes/core/PKPApplication.inc.php:272) In file: /home/xxxxxx/public_html/lib/pkp/classes/core/PKPRequest.inc.php At line: 72 Stacktrace: Server info: OS: Linux PHP Version: 5.2.9 Apache Version: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9 DB Driver: mysql DB server version: 5.1.65-cll


To add, here are the current steps that ive done already but to no avail:
1. I already tried changing permissions to full access (775) on the file directory
2. File path in config.inc.php; (file is the file directory on where the pdfs are stored)
file_dir = file
3. php.ini (post_max_size = 50M, upload_max_filesize = 50M,

Thank you,
Ryan
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby JasonNugent » Fri Nov 16, 2012 5:15 am

Hi Ryan,

The error message being reported there is a "permission denied" error. If you change permissions on a directory, did you make sure to do it recursively? The problem is:

Code: Select all
Unable to move '/tmp/phpdQemxI' to 'file/journals/61/articles/2008/public/2008-5118-1-PB.pdf'


So, you'd have to make sure that the permissions fix was applied to journals, 61, articles, 2008, and public. From the command line you'd normally do that sort of thing with a -R flag to chown:

Code: Select all
chown -R _www file/


where _www is the user that your web server runs as. It may be a different user on your server. Chowning the directory instead of chmoding to a permissions mask is usually less prone to errors, since directories and files have different permission requirements.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 891
Joined: Tue Jan 10, 2006 6:20 am

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby nevermind182004 » Sun Nov 18, 2012 8:31 pm

Hi Jason,

Thank you for the quick reply on solving this problem, really appreciate it. :) However am a bit lost on some steps. i successfully logged into the ssh using the terminal on mac. (xxxx - user) (yyyy.com - domain)

ssh xxxx@ yyyy.com
xxxx@ yyyy.com password:
xxxx@ yyyy.com [/home]# cd /home/xxxx/public_html/
xxxx@ yyyy.com [~/public_html]# chown -R xxxx file/
xxxx@ yyyy.com [~/public_html]#

Upon doing this, i tested again but to no avail. still i can't upload pdf.. Do i need to apply the chown command on every specific folder/file?
I don't understand how'd the permissions changed, as ive only did the migration of files.

Best Regards,
Ryan
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby nevermind182004 » Tue Nov 20, 2012 6:27 pm

Anyone who got the same problem, can share on how you fixed it please? :(
Are there any alternative steps or solution to this problem?

Thank you so much!
Ryan
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby asmecher » Wed Nov 21, 2012 11:44 am

Hi Ryan,

Depending on your server's Apache/PHP integration, your user account (xxxx in the above example) may not be the appropriate user. PHP scripts may run under your user account, or a system-wide user account (e.g. "nobody" or "www-data") depending on how it's configured. If it's using mod-php to integrate PHP with Apache, then that's likely the problem.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby nevermind182004 » Thu Nov 22, 2012 6:54 pm

Hello Alec,

the xxxx user account that i've been using was the assigned user for the ojs site that i was maintaining (home/xxxx/public_html/).
Is there a way to set any default user/group to chown so that i'll not be guessing any account?

To add i've check the details on the Extended PHP Information to know my server API PHP uses on our server:

Server API = Apache 2.0 Handler


I've seen other resolution to use the user:apache, nobody:nobody and such. I really got no idea on what this is about..

but when I tried the nobody:
Code: Select all
chown -R nobody file/ or chown -R nobody:nobody file/


it gave me this multiple lines of result..
Code: Select all
chown: changing ownership of `file/journals/12/articles/1816/public/2122-2192-1-PB.pdf': Operation not permitted


I already tried the chmod but still can't get to upload..
Code: Select all
xxxx@xxxxxx.com.ph [~/public_html]# chmod -R 0755 filler/


Please i badly need your advices guys on resolving this issue.. :S

Thank you,
Ryan
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby asmecher » Thu Nov 22, 2012 10:56 pm

Hi Ryan,

"Apache 2.0 Handler" means you're running PHP scripts as an Apache module, i.e. you're using mod_php. Probably your scripts are running as "www-data" or "nobody". One way to find out is by running a PHP script containing:
Code: Select all
<?php system('whoami'); ?>
Somehow you're going to have to make your files directory (and cache directory and public directory) writable by whatever user that is. The easiest way is to use 777 permissions, but those are insecure and will probably cause you problems down the line. One way is to use PHP scripts to create those directories so that they'll be owned by the proper user; this may involve temporarily granting 777 permissions to the directories they are in, then revoking those permissions once the creation is done.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby nevermind182004 » Thu Nov 22, 2012 11:36 pm

oh wait, i got lucky! i tried chmod. initially all files are set to 755 permission only..

Code: Select all
chmod -R 0777 file/


now its working fine! hahaha.. case solved! thanks so much Alec, Jayson for your support! You're the best ;)

Thanks much,
Ryan
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: Problem in Uploading Files (Galley, Supp. Files)

Postby asmecher » Fri Nov 23, 2012 9:59 am

Hi Ryan,

Glad you got it working -- but as noted above, using 777 permissions means you're open to attacks from other users / scripts running on the same server.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests