"Error while writing file" ( screenshot )

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Posts: 52
Joined: Mon 20. Sep 2004, 04:43

"Error while writing file" ( screenshot )

Post by vrain »


This is during a test of a new host. The folders have correct permissions. What could be a common host problem here?


Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

Maybe it's just the wrong day of the week:
Last edited by spirelli on Fri 15. Apr 2005, 14:35, edited 1 time in total.
User avatar
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany

Post by pico »

:D :D :D :D

this is the random_day_dont_upload(); Function

:wink: :D :wink: :D :wink:
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
User avatar
Posts: 6845
Joined: Thu 30. Oct 2003, 23:48
Location: Berlin, Germany

Post by Pappnase »


is this an new install or an upgraded version!?
maybe you don't ran all upgrade patches correctly!?
Posts: 52
Joined: Mon 20. Sep 2004, 04:43

Post by vrain »

Hi Pappnase, this is a clean new install. I also installed an old version of phpwcms ( 1.4 ) and it had EXACTLY the same problem, so obviously there is a problem with the server.

I contacted the host, and they want me to give them the actual php error, they said I should set the cms into debug mode for that. Any ideas how to do that?


Posts: 52
Joined: Mon 20. Sep 2004, 04:43

Post by vrain »

This the code that gives the error message, -

Code: Select all

if ($dir = @opendir($useruploadpath)) {
					if(@copy($userftppath.$file, $usernewfile)) {
					} else {
						$file_error["upload"] = "Error while writing file to storage (1).";
User avatar
Posts: 6845
Joined: Thu 30. Oct 2003, 23:48
Location: Berlin, Germany

Post by Pappnase »


did you setup all permissions right!?
Posts: 52
Joined: Mon 20. Sep 2004, 04:43

Post by vrain »

Bah, fixed it. Basically, the error was fixed once we enabled "run php as cgi" on the site. I guess there was a problem with sessions or security.

Either way, it'd be great if phpwcms had a "debug" mode where we'd be able to see the actual php error directly.

thanks everyone! phew :roll:

Posts: 20
Joined: Wed 19. Jan 2005, 17:57
Location: Washington, DC

Error while writing file to storage (1)

Post by Dave_G »

Hey All,

I seem to be having the same problem!

Error while writing file to storage (1)

I am confident I uploaded the files correctly, but it still doesn't work! I cannot use FTP Takeover as well for some reason. Here are some screenshots of what I am looking at:




Let me know if you have any thoughts or suggestions! I'm really stuck here!

Posts: 20
Joined: Wed 19. Jan 2005, 17:57
Location: Washington, DC

Post by Dave_G »

Hey Guys,

Any idea on this one at all? I recently found out the hosting company needed to recompile some of the php functions for some reason (why my GD support was not so good!), any idea if any functions need to work for sure for this file upload/filetakeover to work correctly?

I've searched and searched the forums for help on this, but I have tried EVERYTHING I found. Please help!

Here's a link for my PHPinfo:
http://www.davegorrie.com/phpwcms_dev/i ... hpinfo.php

Here is my conf.inc.php file:

Code: Select all


// database values
$phpwcms["db_host"]           = "localhost";
$phpwcms["db_user"]           = "nothing";
$phpwcms["db_pass"]           = "nothing";
$phpwcms["db_table"]          = "nothing";
$phpwcms["db_prepend"]        = "";
$phpwcms["db_pers"]           = 1;

// site values
$phpwcms["site"]              = "http://www.davegorrie.com/";
$phpwcms["admin_email"]       = "dave@davegorrie.com";

// paths
$phpwcms["DOC_ROOT"]          = $_SERVER['DOCUMENT_ROOT'];
$phpwcms["root"]         		= "phpwcms_dev";         //default: ""
$phpwcms["file_path"]         = "phpwcms_filestorage";    //default: "phpwcms_filestorage"
$phpwcms["templates"]         = "phpwcms_template";    //default: "phpwcms_template"
$phpwcms["content_path"]      = "content"; //default: "content"
$phpwcms["cimage_path"]       = "images";  //default: "images"
$phpwcms["ftp_path"]          = "phpwcms_ftp";     //default: "phpwcms_ftp"

// content values
$phpwcms["file_maxsize"]      = 2097152000; //Bytes (50 x 1024 x 1024)
$phpwcms["content_width"]     = 538; //max width of the article content column - important for rendering multi column images
$phpwcms["img_list_width"]    = 100; //max with of the list thumbnail image
$phpwcms["img_list_height"]   = 75; //max height of the list thumbnail image
$phpwcms["img_prev_width"]    = 538; //max width of the large preview image
$phpwcms["img_prev_height"]   = 400; //max height of the large preview image
$phpwcms["max_time"]          = 1800000; //logout after max_time/60 seconds

// other stuff
$phpwcms["compress_page"]     = 0; //0 = OFF, 1-9: page compression ON (1 = low level, 9 = highest level)
$phpwcms["imagick"]           = 0; //0 = GD,  1 = ImageMagick, 2 = ImageMagick 4.2.9
$phpwcms["imagick_path"]      = ""; //Path to ImageMagick (default="" - none)
$phpwcms["use_gd2"]           = 1; //0 = GD1, 1 = GD2
$phpwcms["rewrite_url"]       = 0;  //whether URL should be rewritable
$phpwcms["wysiwyg_editor"]    = 2;  //0 = no wysiwyg editor, 1 = HTMLarea, 2 = FCKeditor, 3 = browser based
$phpwcms["phpmyadmin"]        = 0;  //enable/disable phpMyAdmin in Backend
$phpwcms["default_lang"]      = "en";  //default language
$phpwcms["charset"]           = "iso-8859-1";  //default charset 'iso-8859-1'
$phpwcms["allow_remote_URL"]  = 0;  //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed
$phpwcms["gt_mod"]            = 0;  //0 = Graphical Text MOD disabled, 1 = enabled
$phpwcms["jpg_quality"]       = 75; //JPG Quality Range 25-100
$phpwcms["sharpen_level"]     = 1;  //Sharpen Level - only ImageMagick: 0, 1, 2, 3, 4, 5 -- 0 = no, 5 = extra sharp
$phpwcms["allow_ext_init"]    = 1;  //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"]  = 1;  //allow including of custom external scripts at frontend rendering
$phpwcms["cache_timeout"]     = 14400;  //default cache timeout setting in seconds - 0 = caching Off

// dynamic ssl encryption engine
$phpwcms["site_ssl_mode"]     = '0'; // tuns the SSL Support of WCMS on(1) or off (0) DEFAULT '0'
$phpwcms["site_ssl_url"]      = '';  //URL assigned to the SSL Certificate. DON'T add a slash at the End! Exp. "https://www.yourdomainhere.tld"
$phpwcms["site_ssl_port"]     = '443'; //The Port on which you SSL Service serve the secure Sites. Servers DEFAULT is '443'

// Try to check and uncomment the DOCUMENT_ROOT if you have problems 
// often neccessary on IIS or default MacOS X webserver settings
// Do not use backslash "\" on Windows - always replace "\" by "/"
$_SERVER['DOCUMENT_ROOT']     = '/home/davegor/public_html';
Thanks so much!
Posts: 657
Joined: Tue 17. Feb 2004, 09:56
Location: Cape Town, South Africa

Post by trip »

Hi Dave
this is defintely a "write permissions" problem

do the following
make sure that
- phpWCMS_fielstorage is writable ie 777
- make sure that all subfolders are also writable 777

then logout of wcms, close browser and then try again.
If this happens again, then call your provider and ask them to check that you have permissions to CHMOD on your user.

thats about it
Posts: 24
Joined: Mon 18. Apr 2005, 21:35
Location: Copenhagen, Denmark

Is that all?

Post by olleolleolle »

Hm, should

- disable PHP's SAFE_MODE

be on you list as well?

I'd like to be able to run it with SAFE_MODE enabled. Is that possible?

(At the moment nobody/nogroup sets the permissions on all uploaded files to 0600, which is read and write for herself.)
Olle Jonsson
Posts: 20
Joined: Wed 19. Jan 2005, 17:57
Location: Washington, DC

Post by Dave_G »

Hey All,

Well, I contacted my hosting company and they said the folders are 777, but they felt that because my phpwcms script was in a folder above my public_html, that the script was writing to a folder that didn't exist! So I've put the phpwcms files in my public_html folder so there isn't another folder it has to go through!

I am running with safe_mode off, so that shouldn't be a problem...

Even after all of this, I still cannot upload the files! Here are more of my screen shots of my files structure and permissions, and I even checked the sql and it all seems correct! Please if ANYONE can help! Thanks!

Folder Permissions:

Database Table Structure:

Database Data:

My Adjusted config.inc.php:

Code: Select all

// paths
$phpwcms["DOC_ROOT"]          = $_SERVER['DOCUMENT_ROOT'];
$phpwcms["root"]         		= "";         //default: ""
$phpwcms["file_path"]         = "phpwcms_filestorage";    //default: "phpwcms_filestorage"
$phpwcms["templates"]         = "phpwcms_template";    //default: "phpwcms_template"
$phpwcms["content_path"]      = "content"; //default: "content"
$phpwcms["cimage_path"]       = "images";  //default: "images"
$phpwcms["ftp_path"]          = "phpwcms_ftp";     //default: "phpwcms_ftp"
This is driving me NUTS!

Thanks for any help that can be offered!
Posts: 558
Joined: Wed 14. Jan 2004, 08:05
Location: Atlanta

Post by Ben »

Ugh! I'm getting the whole "Error while writing file to storage" error on a clean install of 1.2.6 which is with my client's existing account with http://www.dreamhost.com. Since this is around my 40th or 50th install, I'll tell you that it's not a chmod issue on phpwcms_filestorage. I've tried both images and documents, to verify that the problem doesn't involve the GD library not functioning properly. I've also tried ftp takeover, with the same negative results.

I think the issue may relate to the php directive allow_url_fopen being set to Off, whereas on my other severs that do function properly it is set to On. Do you think this might be the issue? If so, do you know the syntax to overwride this setting in a local .htaccess or php.ini? (I can probably find it quick from Google, if this is in fact the issue.)

I hate it when people list their whole php info, so I'll just give the highlights, unless someone requests other wise. Thanks for any insight you can offer in resolving this seemingly n00b issue :D
PHP Version 4.4.2

System Linux neo 2.4.29-grsec+w+fhs6b+gr0501+nfs+a32+++p4+sata+c4+gr2b-v6.189 #1 SMP Mon Feb 7 13:23:30 PST 2005 i686
Build Date Jan 31 2006 05:56:17
Configure Command './configure' '--with-apxs=/dh/apache/template/bin/apxs' '--with-mysql=/usr' '--enable-calendar' '--enable-memory-limit' '--enable-exif' '--with-config-file-path=/etc/php' '--enable-trans-sid' '--with-curl=/usr' '--with-mcrypt=/usr' '--without-pear' '--with-gd' '--with-ttf=/usr' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-openssl=/usr' '--enable-mbstring=all'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety disabled
Registered PHP Streams php, http, ftp, https, ftps, compress

allow_call_time_pass_reference On On
allow_url_fopen Off Off
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags On On
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions exec,system,dl,passthru,chown,shell_exec,popen,proc_open exec,system,dl,passthru,chown,shell_exec,popen,proc_open
display_errors On On
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir ./ ./
file_uploads On On
gpc_order GPC GPC
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .:/usr/local/lib/php .:/usr/local/lib/php
log_errors Off Off
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time -1 -1
memory_limit 50M 50M
open_basedir /dh/web/phpmyadmin:/tmp:/usr/local/tmp:/dh/solidclient:/usr/local/lib/php:/home/jfs:/home/.francine/jfs no value
output_buffering no value no value
output_handler no value no value
post_max_size 11M 11M
precision 14 14
register_argc_argv On On
register_globals On On
report_memleaks On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from me@localhost.com me@localhost.com
sendmail_path /usr/sbin/sendmail -t /usr/sbin/sendmail -t
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 10M 10M
upload_tmp_dir no value no value
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance Off Off
Posts: 65
Joined: Fri 25. Feb 2005, 09:40

Post by kiwix »

Hi Ben,

did you remember thsi thread:

http://www.phpwcms.de/forum/viewtopic.p ... highlight=

Maybe that's the same problem.

Post Reply