OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



installation directory not exist or not writable

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.

installation directory not exist or not writable

Postby henry » Fri May 31, 2013 12:57 pm

I am trying to install ojs-2.4.2, I am getting "The directory specified for uploaded files does not exist or is not writable" error.

what I did:

1)download the ojs-2.4.2.tar.gz file
2)mkdir /var/www/html/ojs
3) tar xzvf ojs-2.4.2.tar.gz to /var/www/html/ojs
4) chown -R apache.apache /var/www/html/ojs
5) chmod for public, cache and cache, config.inc.php as required
6) mkdir /var/www/html/files, changed its owner to apache, and make it permission 774
7) on the installation file, i kept on getting the above error messages even though the directory is there, and writable by apache

could some one help?

regards
Henry
henry
 
Posts: 1
Joined: Fri May 31, 2013 12:42 pm

Re: installation directory not exist or not writable

Postby asmecher » Fri May 31, 2013 1:07 pm

Hi Henry,

Are you using mod_php to integrate Apache and PHP? If so, you're heading in the right direction with file ownership. Are you using SELinux? If so, you may need to make some specific changes to your SELinux policies.

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

Re: installation directory not exist or not writable

Postby Astro » Mon Nov 25, 2013 9:17 pm

May I second the original question, so not to duplicate the thread?

So, I've been trying to install the OJS in one of my servers, with no luck. The issue is precisely the error "The directory specified for uploaded files does not exist or is not writable".
I keep receiving this error even when I am positively sure that the directory does exist and is writable (777).

Searching on different posts in the forum I even found the suggestion that users may try to see whether the directory chosen to upload files can be accessed via webbrowser (like with a test.html file in it). In case it is accessible, than users should use an .htaccess file to correct that. So, this seems to be my case, as Indeed I can access any folder in my server via browser. I've tried a couple of .htaccess configurations that indeed blocked the directory from being reached from webbrowsers. But nothing changed for the OJS installation.

Regarding possible localization mistake, I've tried several ways of writing the location. My server has a public folder in the root, called www. This www is the one accessed whenever I type the server IP in any browser. So, my OJS installation files are at http://myip/ojs. And the upload directory is at http://myip/repository. I've tried to input this path as "/repository", "/repository/", "repository/", "http://myip/repository", "http://myip/repository/", "/www/repository/", and so on. Nothing new. The same error message.

Would anyone be able to give me some insights on that?

Many thanks for your time.
Astro
 
Posts: 12
Joined: Mon Nov 25, 2013 8:57 pm

Re: installation directory not exist or not writable

Postby asmecher » Tue Nov 26, 2013 9:08 am

Hi Astro,

Some servers use SELinux, which may require additional configuration to allow the web server to write to that directory.

(Note that 777 permissions are never safe to use, so once you've gotten this working please tighten those up.)

The files directory should be a local directory name on the server ("http://myip/repository", "http://myip/repository/", etc. are incorrect as those are HTTP URLs). This will vary from server to server, so you'll need to determine what the right value for you is, but usually your user's storage will be in "/home/[username]"; in that case, OJS will be in "/home/[username]/www/ojs" (or similar) and "/home/[username]/repository" would be suitable for storing OJS's files. The apparent root directory e.g. in an FTP session often hides the /home/[username] part of the path, but it's there nonetheless.

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

Re: installation directory not exist or not writable

Postby Astro » Sun Dec 01, 2013 2:51 pm

Thanks Alec.

In fact, by following your advices I was able to correct the issues. The only thing that keeps calling my attention is the 777 chmod.

This is interesting. If 777 is not safe to the uploaded files folder to be left as, and without writable permissions in that folder the system has uploads blocked, what is the correct setting for both allowing the uploads without being too unsafe?

One option would may be something like 722 or 733, i.e. without reading rights but with writable rights?

Thanks a lot!
Astro
 
Posts: 12
Joined: Mon Nov 25, 2013 8:57 pm

Re: installation directory not exist or not writable

Postby asmecher » Sun Dec 01, 2013 3:05 pm

Hi Astro,

OJS has to have both reading and writing permissions. The problem is the last digit, which is the "public" readable/writable state. If you allow the public to write, it's a dangerous situation. The trick is to get the file ownership right, so that OJS can read and write files. That means that PHP needs to be considered the "owner user" (first digit) or "owner group" (second digit). You need to ensure not just correct numeric file permissions, but ownership. This will depend on your server's configuration, particularly your server API (mod_php, FastCGI, etc).

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

Re: installation directory not exist or not writable

Postby vikozo » Fri Feb 21, 2014 5:48 am

asmecher wrote:Hi Astro,
Some servers use SELinux, which may require additional configuration to allow the web server to write to that directory.
Public Knowledge Project Team

Could you please tell what additional configuration should be done?
And maybe why it is not possible to keep this directory in the same structure then the website? :?
have a nice day
vincent
vikozo
 
Posts: 5
Joined: Fri Feb 21, 2014 2:08 am

Re: installation directory not exist or not writable

Postby asmecher » Fri Feb 21, 2014 9:51 am

Hi Vincent,

Putting the files directory in the same tree as the website generally means that remote users, if indexing is enabled or they can guess filenames, could potentially download submission files directly from the web server, bypassing OJS's access controls. This can expose documents to the public in an uncontrolled way. For that reason, we generally recommend putting the files directory outside the web server's path. One alternative would be to use a .htaccess file to deny direct access, in which case it would be safe to put the files path into the web server's reach.

There are lots of guides online for setting up SELinux to work with PHP uploads, e.g. http://albertech.net/2011/03/fix-fedora-selinux-permissions-for-php-file-upload/.

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


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 5 guests