Roundcube Community Forum

Release Support => Pending Issues => Topic started by: trax on April 20, 2009, 09:38:06 AM

Title: File upload failed
Post by: trax on April 20, 2009, 09:38:06 AM
Hi everybody

I have a roblem when trying to upload a file as an attachment, size doesn't matter. I can Select the file and in the moment i click "upload" a red status bar on the top appears and tells: "File upload failed".

I have the temp dir configured as temp/ and it is writable. It even creates a file in the temp dir, but this file is only "touched" and remains 0KB.

I can not find anything in the logs.. does someone have an idea?

cheers
Title: File upload failed
Post by: rosali on April 20, 2009, 09:46:03 AM
Which OS? Windows? Official RoundCube releases need full path for windows (C:/temp).
Title: File upload failed
Post by: trax on April 20, 2009, 10:23:10 AM
Hey, sorry for that, seems like i'm a little lazy today...

uname -a
Linux hostname 2.6.18-5-686-bigmem #1 SMP Tue Dec 18 22:34:10 UTC 2007 i686 GNU/Linux

apache2 -V
Server version: Apache/2.2.3
Server built:   Sep  6 2008 09:52:20
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"


php -v
PHP 5.2.0-8+etch13 (cli) (built: Oct  2 2008 08:26:18)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

cat index.php | grep Version
 | Version 0.2.1                                                           |

after trying to upload a file, my temp dir looks like that:

ls -lah temp
total 12K
drwxrwxr--  2 www-data vu2005   4.0K 2009-04-20 16:21 .
drwxrwx--- 11 vu2005   www-data 4.0K 2009-04-20 16:19 ..
-rw-r--r--  1 vu2005   vu2005     32 2009-04-17 14:10 .htaccess
-rw-------  1 www-data www-data    0 2009-04-20 16:21 rcmAttmntrhpc26


cat config/main.inc.php | grep temp/
$rcmail_config['temp_dir'] = 'temp/';


any ideas?

thanks :)
Title: File upload failed
Post by: rosali on April 20, 2009, 01:57:45 PM
JohnDoh? I'm not a Linux guy.
Title: File upload failed
Post by: Julius Caesar on April 21, 2009, 03:30:15 AM
Quote from: trax;18564

php -v
PHP 5.2.0-8+etch13 (cli) (built: Oct  2 2008 08:26:18)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies


If I check the wiki (http://trac.roundcube.net/wiki/Howto_Requirements), the minimum requirement for PHP is version 5.2.1 and not 5.2.0. But the install info just speaks of v5.2. Maybe here is a problem.
Title: File upload failed
Post by: trax on April 21, 2009, 03:53:54 AM
Okay, it was a PHP misconfiguration:

upload_tmp_dir = /tmp/ was not set in php.ini, then the system took the system default, wich is /tmp (without trailing slash). And then:

[Mon Apr 20 16:21:06 2009] [error] [client X] PHP Warning:  Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/virtual/foo.ch/webmail/:/usr/share/php/:/tmp/) in Unknown on line 0, referer: http://webmail.foo.ch/?_task=mail&_id=62217413149ec84c9d7fb2&_action=compose
[Mon Apr 20 16:21:06 2009] [error] [client X] PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0, referer: http://webmail.foo.ch/?_task=mail&_id=62217413149ec84c9d7fb2&_action=compose

And open_basedir was not defined in php.ini.

It works now, but i still wonder why PHP tries to safe stuff in /tmp/, although i configured temp/ in the roundcube config..??

Thanks a lot & happy uploading, Simon
Title: File upload failed
Post by: Julius Caesar on April 21, 2009, 04:29:27 AM
Quote from: trax;18582
but i still wonder why PHP tries to safe stuff in /tmp/, although i configured temp/ in the roundcube config..??


Because the actual upload is a php-action, which uses the setting for temporary files in the PHP.ini and saves it in the location defined in the RoundCube config. Each of these temp locations has it's own purpose.