<<< Back to the TFU FAQ

TFU flash upload faq image 14. Where to find php.ini and how to use it

The php.ini is your php configuration file of your server. It's not part of TFU/JFU and you have to make changes here to increase some limits I have explained already e.g. in howto 4. There are several locations where the php.ini files is/can be.

  • Private hosting: In the config directory of your web server. For apache this is e.g. in the 'apache\bin' or the 'php' folder. The locations below should work too.
  • Shared hosting: If you are on shared hosting you normally cannot change the php.ini directly. But most hosters allow to have a custom php.ini in the root directory or even in a sub directory.
    • For TFU: Save your php.ini in the folders where you have located tfu_login.php and tfu_upload.php.
    • For JFU:
      • <joomla root>/administrator (That the right values are shown in the backend)
      • The tfu folder: <joomla root>/administrator/components/ com_joomla_flash_uploader/tfu/ ; since JFU 2.11: administrator/components/ com_jfuploader/tfu/
        OR if you have the tfu folder in the site: components/ com_joomla_flash_uploader/tfu (for the flash itself.) ; since JFU 2.11: components/com_jfuploader/tfu/
    • For WFU:
      • <wordpress root>/wp-admin (That the right values are shown in the backend)
      • The tfu folder: <wordpress root>/wp-content/plugins/wordpress-flash-uploader/tfu/

    If this does not work you have to ask your hoster! php.ini settings do not work recursive! Therefore you have to have the php.ini file in several folders.

The usage is really simple. You overwrite the settings from the default php.ini with the settings you set here. A simple example for a custom php.ini for TFU would look like this.

upload_max_filesize = 20M
post_max_size = 20M
memory_limit=64M
max_input_time=1800
max_execution_time=1800
default_socket_timeout=1800

This defines a 20 MB upload limit, php memory of 64MB and timeouts of 30 min. There are most of the time maximum limits by your hoster you cannot exceed.

For a complete list of settings that you may configure in the php.ini file, please refer to the PHP manual page found at http://www.php.net/manual/en/ini.list.php. Please be informed that the php.ini file does not require all of these settings; only enter the line that you wish to change from the default value.

When changing the maximum file upload size, please ensure you have changed both the upload_max_filesize and post_max_size configuration together.  The two settings should share the same value.

If you want to set this values in a .htaccess you have to add 'php_value ' before each setting e.g.

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value memory_limit 64M

If .htaccess or php.ini can be used depends on your hoster. Try - and if it does not work ask your hoster. A maximum of 2 GB per file is possible with optimal server configurations.

Session problem

If you find a message in the log about the session you should set the session save path to a writeable directory. You can do this by setting
session.save_path=<path>
in the php.ini or by setting
php_value session.save_path <path>
in a .htaccess file.

Redirect the php error log

By default php errors are written to a php_error log. TFU does redirect the errors to the file tfu.log. BUT this is only possible for the errors that happen in the script. If an error happens before because of e.g. a limit in the php.ini the errors are written to the default error log of php. If you enable the upload debug and you get there the output of an empty file array "3a. $_FILES content: Array ( )" then this is the case. By default this log file is most likely written to a directory you don't have access (xampp: apache/logs) on shared hosting and unfortunately not all web hoster provide access in their backend. But most hosters allow to redirect this output by setting the variable error_log.

You can do this by setting
error_log=<full path with log file >
in the php.ini or by setting
php_value error_log <full path with log file >
in a .htaccess file.

I recommend to first try the .htaccess version because this was working on my server ;). You can test the setting by creating a small test file in the tfu directory and execute it:

<?php
error_log("test");
?>

you should get a message displayed in the specified file.

Change the location of the temp upload folder of php

Please read howto 19 first if you really need to do this because this should be reported by a specific error. So if the temp upload folder of php is not set correctly or this folder has maybe a quota which is to small or the temp folder is simply full some hosters allow to redirect this folder to one you define:

You can do this by setting
upload_tmp_dir=<path to a writeable directory>
in the php.ini or by setting
php_value upload_tmp_dir <path to a writeable directory>
in a .htaccess file.

I recommend to first try the .htaccess version because this was working on my server ;). You can test the setting by creating a small test file in the tfu directory and execute it:

Follow TWG at
Twitter


Like TWG
on Facebook