3

I have Roundcube installed on Ubuntu 14.04, using NGINX, with static IP, SpamAssassin, ClamAV . Sending/receiving email was fine including downloads, however cannot upload anything to send.

Configuration

php.ini file

memory_limit = 256M
max_execution_time = 60
;open_basedir =
log_errors = On
post_max_size = 100M
file_uploads = On
upload_tmp_dir = /tmp
upload_max_filesize = 100M

Folder Permissions

/tmp
srw-rw---- 1 nginx nginx

/roundcube/temp
drwxrwxrwx  2 nginx nginx   4096 Feb 20 00:41 temp

In nginx.conf, under http directive, I have set

client_max_body_size 100m;

Error log

-note: output below I removed domain, and directory names.

FastCGI sent in stderr: "PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0" while reading response header from upstream, client: X.X.X.X server: domain.com, request: "POST /mail/?_task=mail&_id=~~~from=compose&_action=upload HTTP/1.1", upstream: "fastcgi://unix:/tmp/php5-fpm.sock:", host: "domain.com", referrer: "https://domain.com/mail/?_task=mail&_action=compose&_id:~~~~

Troubleshooting

I've set the mail/temp folder to 777 just to see if it would write a file there, and it did, but Roundcube still gave the error "File Upload Failed". Normally, that directory /mail/temp is set to 755 and would write 0kb files as opposed to 777 a file actually would be written but error in roundcube remains same either way.

I also played around with the root (PHP pointed) /tmp directory permissions to see is 777 would help (all files mentioned are accessible by nginx:nginx) ...no joy, same error output by Roundcube: "File Upload Failed". As a last resort I pointed PHP to the same /mail/temp to see if it would write, it did but still -same roundcube error "File Upload Failed".

How can I solved this upload problem?

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
axetone
  • 41
  • 1
  • 6
  • Do you have space left on the discs? Use `df -h` to find that out. What if you turn up `$config['debug_level']`? – sebix Feb 20 '15 at 14:47
  • @sebix -yes, I have a 160Gb drive with only 3.3.G used. It's a new install. – axetone Feb 20 '15 at 16:48
  • Why on *earth* is `/tmp` owned by nginx? That's ... not correct and likely a huge security problem, as the web server will effectively be able to read all content. It should be owned by root! – vidarlo Jun 29 '21 at 07:40

2 Answers2

0

Just had the same issue. Eventually tracked it down to a blank upload_tmp_dir value in my php config so try adding something like this to your apache config, or edit your php.ini:

php_admin_value upload_tmp_dir /var/tmp

Also added filesystem_attachments to my $config['plugins'] array

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
-2

Restart both the services

$ sudo service php-fpm restart
$ sudo service nginx restart
  • 1
    You would need to explain how this is supposed to help. – Sven Jul 27 '16 at 12:15
  • don't know but I did that and everything was working as it should! – Mudit Jain Jul 31 '16 at 20:21
  • actually this worked for me. but no idea why it worked. /tmp is set to 777 and i verified it is the temp dir. – Nizar Blond Apr 29 '19 at 15:32
  • Update: Restarting these services would not have solved the issue I posted ( almost 5 years ago). I am only sharing because recently I will be re-building a new site, and for those that ran into this same issue, you'll have to look more closely at newer versions of RoundCube...-because I gave up on it assuming it was a bug in their platform. I will be reevaluating if using only a cloud-service is a better way to go (now that they are so prolific) as opposed to hosting an onPrem server,...-so I will likely retest a new version within the next 60-days and update everyone (if they're interested). – axetone Jan 28 '20 at 02:49