File related problems

This guide will help you to solve the most common problems related to files.

File permissions

First of all (even if you don't have any problems at the moment) you should make sure that your current file permissions are right set:

/site/assets/ 755 (recursively)
...

While installing ProcessWire you have the chance to control which file permissions should be given to files and folders created by ProcessWire. If you want to change them afterwards you can find them in your /site/config.php or use the ProcessWireConfig module to change/see them:

// default settings
$config->chmodDir = '0755';
$config->chmodFile = '0644';

Error log won't update

If you get the note that there was an error which got logged in the error log ("Unable to complete this request due to an error. Error has been logged.") but the error log isn't updated this is probably due to incorrect file permissions (just scroll a bit upwards).

Download modules within ProcessWire is not possible

If you want to use ProcessWire's build-in functionality to install new modules directly from the ProcessWire backend you have to make sure your provider has set "allow_url_fopen = 1". (If your not sure try to contact your hoster directly and ask him or use PHP's phpinfo() function).

Or if you have access to your php.ini you can manually add this setting.

UPDATE: This problem shouldn't occur anymore in up-to-date ProcessWire installations (2.5+) as there is a curl-fallback function now.

Upload stuck at 100%

If this error occurs to you there are various reasons this could come from. First step should be to take a look into your browser's console and check if there is any error.

Here are two solutions that might work:

  1. Take a look at your mod_security settings. Sometimes they are incorrectly configured and prevent the page from using Ajax Upload.

  2. Disable Ajax upload. You can do this by editing wire/modules/Inputfield/InputfieldFile/InputfieldFile.js (it's normally not recommended to edit files in /wire/ but in this case you can do it just for debugging. Note that this file be overwritten when you update ProcessWire).

    Somewhere in this .js file you should find a part looking like this:

    if (window.File && window.FileList && window.FileReader && $("#PageIDIndicator").size() > 0) {  
            InitHTML5();
        } else {
            InitOldSchool();
        }

    Now just replace InitHTML5() with InitOldSchool() and try if uploads are working again or at least anything has changed. If not you can get additional support at the forum.

"Invalid file extension, please use one of:"

If this error occur's there are two possible reasons:

  1. You haven't configured your file/image-field completely. To solve this just go to "setup > fields > yourfield", click edit and just hit save afterwards.
  2. You haven't added the file extension to the allowed file extensions of your field. To solve this go back to that field again, click on it's "details" tab and note the file extensions. Make sure that the file type you are uploading is in the list of allowed extensions. Add more extensions as needed and save the field.

Can't upload .exe/.php/.cgi/...

To improve the security of your ProcessWire installation there is a list of "bad" file extensions which can't be uploaded even if you added their type to the "allowed file extensions" of your field. These list is defined in your /site/config.php:

$config->uploadBadExtensions = 'php php3 phtml exe cfm shtml asp pl cgi sh vbs jsp';

If you're sure you want to allow your users to upload those filetypes you can change this setting directly in your /site/config.php or you can use the ProcessWireConfig module.

Note: It's probably better not to change it and tell your users to wrap those filetypes into zips and upload the .zip file.

Can't upload huge files / huge file upload stucks

If you want to upload huge files into your ProcessWire installation make sure your post_max_size and upload_max_filesize are bigger than your file. You can check this by using PHP'sphpinfo() function or by using the ProcessDiagnostics module.

If you notice that it is smaller than your file you can try to increase it by adding the following lines to your htaccess file. Note: In most cases this won't help.

<IfModule mod_php5.c>
php_value post_max_size 240M
php_value upload_max_filesize 200M
</IfModule>

If this is not working you can either contact your hoster and ask for increasing your post_max_size and upload_max_filesize or using a little work around:

You can create a /tmp/ folder in your ProcessWire installation's root directory and upload all your huge files into it via FTP. Afterwards you create a file in the same directory as your /tmp/ folder (e.g. "uploadhelper.php"). This file should look similar as this:

<?php
include 'index.php';

$filepage = $pages->get('the-page-you-want-to-add-the-files-to'); // you have to change this line
$filepage->of(false);
$filepage->fieldname->add($config->paths->root.'tmp/hugefile.zip'); // you have to change this line for every file or use a for each loop
$filepage->save();
?>

This code tells ProcessWire to add the huge file to a given page and copy it to the assets folder. Afterwards you can delete the file from the /tmp/ folder. Feel free to adjust it to your needs. I marked all the parts you have to adjust in bold.


  1. 500 Internal Server Error
  2. Login Problems
  3. URLs not working
  4. File related problems

Comments

  • David L. Kaplan

    David L. Kaplan 4 years ago 72

    Another cause of "This request was aborted because it appears to be forged" is a too many stale session files that didn't get garbage collected by PW because of some interaction with Ubuntu servers. Adding a couple of lines of php to the config usually fixes it apparently:

    ini_set("session.gc_probability", 1);
    ini_set("session.gc_divisor", 100);

    See:
    https://processwire.com/talk/topic/6001-this-request-was-aborted-because-it-appears-to-be-forged/?p=58636
    https://processwire.com/talk/topic/5796-session-handler-database-do-not-delete-old-sessions/?p=56596

  • Thomas Grahlke

    Thomas Grahlke 3 years ago 32

    On a 1 & 1 domain it works only with the lowest possible in the .htaccess:

    # -----------------------------------------------------------------------------------------------
    # Pass control to ProcessWire if all the above directives allow us to this point.
    # For regular VirtualHosts (most installs)
    # -----------------------------------------------------------------------------------------------
    # RewriteRule ^(.*)$ index.php?it=$1 [L,QSA]

    # -----------------------------------------------------------------------------------------------
    # 500 NOTE: If using VirtualDocumentRoot: comment out the one above and use this one instead.
    # -----------------------------------------------------------------------------------------------
    RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]

  • Peter Knight

    Peter Knight 2 years ago 10

    Just wanted to add to this as Ive spent the morning with a 500 error and finally resolved.
    1. Ensure you have debug mode on in your config file. $config->debug = true;
    2. In my case, I had the dbhost in config set to localhost. Make sure your new host doesn't use something different.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.