Hi,

I'm running a couple of modules that require the uploading of files. However the file size is limited and one of the modules (audio) mentions to change the settings in the php.ini file. Where can I find this file?

I've looked through the files in my ftp but can't find it.

Thanks for any help.

Comments

devx’s picture

if you're on a shared hosting account, your host will most likely not allow access to the actual php.ini.

If your host allows you to set custom php.ini file:
create a new plain text file called php.ini with the following lines (for increasing file upload size limit, eg. 10M)
upload_max_filesize 10M
post_max_size 20M

and place that php.ini in the root of your website.

If your host doesnt allow this, add the following lines to the .htaccess file
php_value upload_max_filesize 10M
php_value post_max_size 20M.

Once you have done so, to confirm create a phpinfo file* and check php settings.

Php info file is just a plain text file with the following code:

phpinfo();

save it as info.php and upload to the root of ur site and browse to it. Make sure you delete it after you've done checking/development. It would suck if google indexed it.

contact your host if none of the above work.

styro’s picture

You can also set some of the PHP settings in your settings.php or .htaccess file.

If it is a server wide setting though, you might not be able to change it yourself on shared hosting. phpinfo() will let you know whether or not the change worked.

settings.php example:

...

/**
 * PHP settings:
 *
 * To see what PHP settings are possible, including whether they can
 * be set at runtime (ie., when ini_set() occurs), read the PHP
 * documentation at http://www.php.net/manual/en/ini.php#ini.list
 * and take a look at the .htaccess file to see which non-runtime
 * settings are used there. Settings defined here should not be
 * duplicated there so as to avoid conflict issues.
 */
ini_set('arg_separator.output',     '&');
ini_set('magic_quotes_runtime',     0);
ini_set('magic_quotes_sybase',      0);
ini_set('session.cache_expire',     200000);
ini_set('session.cache_limiter',    'none');
ini_set('session.cookie_lifetime',  2000000);
ini_set('session.gc_maxlifetime',   200000);
ini_set('session.save_handler',     'user');
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid',    0);
ini_set('url_rewriter.tags',        '');

...

.htaccess example:

...

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

...

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ

Jboo’s picture

Thanks both of you, I'll try your suggestions.

My new EasySnoozing, Nursing and BusinessEgghead websites on D7!

dsnydernc’s picture

Just to add to this - I have read in guides that starting in the last couple of versions of php that you can no longer pass these parameters in the .htaccess file... this is not correct. I have adjusted my max file sizes in the drupal .htaccess file and it works just fine using php 5.2.

Though changing the php.ini file is the "correct" way of doing it - adding the lines to the .htaccess file results in the same functionality - and this will be the only available method for most folks on shared hosting.

walterbyrd’s picture

I added these two lines in .htaccess. I wrote and ran the phpinfo thing. My local settings for max file size were set to 10M, although the master settings were still 2M.

The big problem is that WebFM won't load any directories after I do this. Does this make any sense?

spatialguru’s picture

I'm struggling with filesize settings with WebFM as well. It seems to me that both the admin/settings/upload and admin/settings/webfm forms lie. phpinfo confirms for me that I have my uploads set to 100M, but these settings say it's set to 4MB. Of course my only php.ini (/etc/php.ini) says 100MB. So what's up?

andreavr’s picture

Refer: http://drupal.org/node/177705

Took me ages to find this, I'm using WebFM on Drupal 5.7 and updating .htaccess in my root directory worked - specifically:

About the values you need to add, the php documentation says that for upload_max_filesize to work:
- post_max_size must be bigger that upload_max_filesize
- memory_limit must be bigger than post_max_size

There is also a Drupal limitation (by design) which won't let you upload a file bigger than half your post_max_size. So, to be able to upload 8M files you could use (for example):

In php.ini, at the end:

upload_max_filesize = 8M
post_max_size = 16M
memory_limit = 24M

Or, in .htaccess, any place.

php_value  upload_max_filesize  8M
php_value  post_max_size  16M
php_value  memory_limit  24M 
rahulbaisanemca’s picture

Now location of php.ini file is /etc/php5/apache2/php.ini

for more info on php.in