I just started testing my upload and uploaded a patients lab result. I am getting this error
Warning: mkdir() [function.mkdir]: Permission denied in /var/www/openemr/controllers/C_Document.class.php on line 78
Warning: move_uploaded_file(/media/disk/EMRServerBakup/docs/4/zielab.pdf) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/openemr/controllers/C_Document.class.php on line 90
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpgvXUN3’ to ‘/media/disk/EMRServerBakup/docs/4/zielab.pdf’ in /var/www/openemr/controllers/C_Document.class.php on line 90
Any idea. This forlder is set to chown www-data.www-data.
Check your folder ‘/media/disk/EMRServerBakup/’ and all sub-folders. Make sure they are:
1) Owned by www-data:www-data
2) Are write-able by the www-data group
3) www-data is actually the user that runs the PHP script (i.e. runs the WWW server process)
I’ve created folders and changed ownership but forgotten to make the folder write-able by a certain group. Sometimes I just make the folder world write-able to make my life easier. It’s not the best decision from a security standpoint but in my case I have a very tightly controlled network.
Ok, I solved the ownership problem. The 2nd hard drive was fat32. Linux cannot do anything in changing ownership when the partition is windows base, fat32 & ntfs. I had to change it to ext3 to customize ownership. Now that I have the privilege correct, I have another problem. I want to import all the scanned and faxes into openemr but want to store it on this 2nd hard drive and keep the files and folders lean and mean. Making changes in config.php and global.php to point to that document folder on the 2nd drive still give the same error. Mind you that the folder is owned by www-data. Then I also try to do a symbolic link from openemr/document to the document folder on the 2nd drive is not working either. Actually, the link did not work. Anyone know if this can be done? I read the tutorial on making symbolic link but it is not working for me
(ln -s /media/sdb3/scan/ /var/www/openemr/documents/docs4/)
Often times you’ll create a symbolic link and expect it to work just fine on web page. But it turns out you need to change some config variables in Apache. In your case this might be the trouble. Take a look at your Apache configuration. Here’s a little primer about the FollowSymLinks directive:
Specifically, you might need something like this in your Apache config:
OK, first, can you verify the symlink was created properly? I’ll admit that I often get turned around when creating symlinks. To make it easier on myself I usually ‘cd’ into the directory where I want the link to be created.
For example, If I want to create a link named ‘docs4’ inside the folder /var/www/openemr/documents and have it point to /media/sdb3/scan/, then I will first ‘cd /var/www/openemr/documents’ then ‘ln -s /media/sdb3/scan docs4’.
Next, you need to make sure you have proper ownership and permissions on /media/sdb2/scan so that www-data user AND group can read/write/execute. So something like this would be necessary:
chown -R www-data:www-data /media/sdb3/scan
chmod -R 775 /meda/sbd3/scan
Note the ‘-R’ means to recurse into the subdirectories and change their ownership and permissions too.
At this point you should have a working symlink. You can verify this by going into the folder /var/www/openemr/documents/docs4 and seeing if you are truly looking at the contents of /media/sdb3/scan.
The next step is to make sure Apache can access that folder too. The quick and dirty method is to try accessing the folder via a URL. Something linke http://<yourserver>/openemr/documents/docs4 … what happens? Since there’s no HTML in that folder you should get either a directory listing or ‘page cannot be displayed’ error. If you get something about unauthorized access then it’s time to look into the Apache configuration again.