### Upload File Size Limit Increase is NOT effective

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Upload File Size Limit Increase is NOT effective

Hello,

The Problem:
I am not able to set the upload file size to 60 MB (Moodle 1.9.1, Linux, PHP 5.2.4, MySQL 4.1.22: hosting with a hosting service provider)

Basic Functions are OK:
I am able to create and use Courses normally. Originally the max size limit was 2MB; I wanted to increase it to 60 MB.

What I wanted to do:
After reviewing several posts in these Forums, I wanted to do these to accomplish my goal
1. Find where the PHP.INI file is (my "info.php" showed that the php.ini's path as /usr/lib/ and a local copy /usr/local/lib/php.ini was in use. I couldn't physically find this file as I could only access "/home/mysite/...")
2. Add the following two entries
post_max_size = 60M

What I actually did:
I created a new file, php.ini with just the two lines
post_max_size = 60M
and placed it in the moodle folder (not in the usr/lib or usr/local/lib folders.

What I observed:
When I go to mysite/info.php, I get full suite of PHP configurations.
I do see the following entries:
post_max_size=60M

When I go to Site Administration >> Security >> Site Policies, I do see the following:
Maximum uploaded file: with options that are more than the original 2 MB (5, 10, 20, 50, and 60 MB).

I thought, the problem was solved ! But, no....

The problem yet to be solved:
When I go to create / edit a course under course >> Settings, I only get options upto 2 MB (not beyond that) for Maximum upload size parameter.

My Guess:
It appears the Course Settings page is looking at some other PHP.INI file (probably the original PHP.INI) and displaying the data from there (which should be 2 MB max.)

Whereas, the Site Administration >> Security >> Site Policies page is looking at the PHP.INI I created and placed in the Moodle folder (with just two lines).

Key Question:
How can I make the Course Settings page and the whole site to look at the PHP.INI file I placed in the Moodle folder instead of looking and using other versions of PHP.INI files?

My Request:
Any help is greatly appreciated!

Regards,
VJ

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

I think your guess is correct. What are your web hosts policies and setup procedures regarding a custom php.ini? Sticking a php.ini file hither and thither may have worked for php 4.x but I think not in php5.

Many web hosts provide a way for you to employ your own php.ini since you can't edit the global php.ini which is used for all clients.

Search your web hosts docs for "cutom php.ini" ro some such and then follow their directions.

However, opening up your system like that is probably not advisable. As suggested elsewhere, it is more advisable to use sftp to upload large files and then move them about, unless you really expect students and teacher to regularly be upload files this large..........

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

MG,

You are correct about php5. With version 5.0.0 and higher, there is only one active php.ini file. The simplest way to find it, I think, as I have said many, many times in this forum, is to run phpinfo and look for "Configuration File (php.ini) Path" near the top of the output page. It should work with any system (Linux, Windows, etc.).

VJR,

RLE

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

See below for how you can do it on Bulehost....not sure if your host uses the same process, but this may help. Notice you have to include your custom php.ini in several places to get it to work...you can't just drop it in the webroot. If you have created a custom php.ini then you may try to add it to the same places I recommend in the thread and see if it works for you.

http://moodle.org/mod/forum/discuss.php?d=94601#p417707

Steve

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

Hi Marc, Richard, and Steve,

Thanks a lot for your prompt and useful responses.

I have been trying several options for the past several days without any desired results. Just now a minute ago I saw Steve's response and tried to follow those steps. It now works fine; I am able to upload files as large as 80MB.

Here are the steps I followed:

1. Created a text file and named it as PHP.INI and added the following lines:
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 600
max_input_time = 600
memory_limit = 128M 
2. Placed (copied) the above PHP.INI file into the following folders:
\home\username\public_html\moodle\ {"moodle" is the Moodle install folder}
\home\username\moodledata {"moodledata" is the data folder}

3. Upload of large files working now!!!

4. Key Points to remember (These apply to situations similar to mine; I am using a hosting provider (kiosk.ws) with LAMP environment + CPanel.
4.1 Different features of Moodle (that deal with Max file size) apparently need different copies of PHP.INI to be placed in the corresponding folders (if we want to override the default PHP settings)
"Course settings" page uses PHP.INI placed in the "course" folder
"File Upload" page uses PHP.INI placed in the "files" folder.

I will be happy to assist others having similar problems

Thanks again for your prompt responses!
VJ

Average of ratings: Useful (4)
Re: Upload File Size Limit Increase is NOT effective

Hi,

Many thanks to Vijay and others who posted previously in this thread, I was having the same problem with my hoster and Vijay's PHP.INI file did the trick!

Cheers,

Marc C.

Average of ratings: -
Re: Upload File Size Limit Increase

Dear Vijay,

By your post of a year ago, you sound as though you went through the same steps I am currently going through at the moment. - I am new to moodle and php.

I have installed Moodle on a LAMP hosted server (1and1.fr) and I am now trying to increase upload_max_filesize. (10M to start with)

I have done the following:

Created a php.ini file with the following:

safe_mode = off;
magic_quotes_gpc = on;
magic_quotes_runtime=off;
short_open_tag = on;

post_max_size = 10M;
max_execution_time = 300;
max_input_time = 300;
memory_limit = 10M;

I have copied this file in the 6 directories:

Root (info.php responds to changes here)
moodle (info.php does not respond to changes here)
moodle/admin (info.php does not respond to changes here)
moodle/course (info.php does not respond to changes here)
moodle/files (info.php does not respond to changes here)
moodledate (info.php does not respond to changes here)

I have also created a .htaccess file in the moodle directory:

LimitRequestBody 0

If you or others know where I'm going wrong, i'd really appreciate some guidance.

Thanks

Stephen

moodle 1.9.5

Average of ratings: -
Re: Upload File Size Limit Increase

Not all web hosts allow you to use a custom php.ini. Some of them require you to use other methods. Ask them what to do first.

Average of ratings: -
Re: Upload File Size Limit Increase

I spoke with them on the phone : They allow custom php.ini files (and I understand their upload goes up to 10M).

Average of ratings: -
Re: Upload File Size Limit Increase

Stephen,
Please search the docs on php.ini - multiple copies of php.ini are only necessary if you are running php4. Many web hosts have specific limitations as far as custom php.ini files

Additionally the 1and1 FAQ provides instructions and instructs users to contact tech support if changes to file don't work

Average of ratings: -
Re: Upload File Size Limit Increase

Marc,

Thank you for your post, very helpful - I have deleted php.ini files in sub directories: admin - course - files - moodledata

Not quite there yet as I have only 8M upload.

I live in France - have a contract with 1and1 france - things are slightly different here, I have FAQ'd and been on the phone repeatedly.

Average of ratings: -
Re: Upload File Size Limit Increase

viva la difference - but I can understand your frustration....

Assumign you are running php5, I might first suggest that follow 1and1's instructons if they have provided any to change BOTH limits to 1M.... this will let you know whether in fact your php.ini changes are being read at all..... if your moodle site wide limits are then topped at 1M then you know the file is being read and it is not a Moodle issue at all.... but likely an apache conf issue (more on that below)

There are three general locations where php directives can be inserted.... apache conf files (note the notes about ubuntu and the conf.d directory) and apache htaccess files (both of which use the apache format for these directives), and php.ini (which uses the php format of these directives.)

htaccess files are by directory, so assuming you have access you can check all your directories to make sure they are clean.

apache conf files are found in one or two directories that may not be accessible by you, but you should be knowledgable enough to determine what OS 1and1 is running, whether the OS employs a conf.d directory and whether there are any php directives there, or in any of the base apache conf files, such as httpd.conf. If 1and1 is telling you that there is a master 10M limit, then undoubtedly they have choked this either via a php.ini file or via apache conf files, and you will want to ask them to provide you a copy so you can check them out for yourself

now, as far as php.ini, souring order is very tricky, and the bottom line is that your php.ini needs to be in the directory with the php executable, which in the case of running php as a cgi is php or php-cgi.... in shared systems you may have to actually take some action to copy the executable into your own cgi-bin.... these steps are covered in the askapache pages I reference in the docs.

et je parle le francais comme une vache espanol, so I haven;t a clue how the above nmight translate to something your tech person would understand - I am afraid you are on your own linguistically.....

bon chance and post back 1and1.fr's comments on the above....

Average of ratings: -
Re: Upload File Size Limit Increase

Thank yo so much for your post Marc, you've given me some serious tools to work with here.

I'm away for a few days but will post on progress during next week.

All the best

Stephen

Average of ratings: -
Upload File Size Increase (Lunarpages Shared Hosting)
This may be helpful to someone.

I contacted Lunarpages to ask them how to increase the upload size for an account I have with them. This is what they sent me. It took maybe five minutes and worked like a charm.

Thank you for contacting Lunarpages Helpdesk.

You can change the upload file size by doing the following:

Put the following in a regular text file named php.ini in the same folder as the upload script:

post_max_size = 5M

Replace the 5 with whatever size you want. If you are letting other people upload, a size cap protects your storage space from abuse/overuse.

If you want all your site folders to have the same setting, put the php.ini file in public_html folder.

You will then need to add this line to a .htaccess file:
(Please replace "yourusername" with your cpanel user name an add to the end of the comand line the folder(s) to the location of the php.ini file - Also there is a space between path and /home)

I hope this was helpful. Please get back to us if you need any further assistance.

Regards,
Art

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hi Art,

This is the closest I've got (I think) to solving this issue - I am new to Moodle admin and am trying to increase the max upload size on my Moodle.

I am using version "1.9.5+ (Build: 20090527)"

I have direct access to the web server so use no Apache or Cpanel - just access via a remote desktop.

I have created the php.ini file as directed and placed them in the folders:

Moodledata, Moodle, admin, course and files.

Moodle being the root folder for the schools Moodle.

The upload size hasn't changed but from your post I understand you need to add some code to the .htaccess file - is this correct?

My .htaccess file (found in E:/Moodle/lib/htaccess)contains the following code referring to file size:

### The setting here turns off this limitation

LimitRequestBody 0

### These are optional - you may not want to override php.ini
### To enable them, remove the leading hash (#)

#php_value post_max_size 2M

Should I place your code "suPHP_ConfigPath /home/Yourusername/public_html" could you let me know the code in my case?

In desperation I even tried removing the # and increasing the 2's and combinations of this with no joy

Many Thanks,
Dewi

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)
Hi Dewi,

If you have direct access to your server you should be able to achieve this a whole lot easier. Can you let us know what environment you are running? i.e. Server Operating System, PHP Version and Web Server software version.

Jon

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

apache 2.2.11, mysql 5.0.77, php 5.2.9 and windows os .

i creaed moodledata directory in main root directory. but it is showing moodledata directory is not available to write. i changed that folder permissions also. again same problem. can any one help me. since two days i am trying to solve this problem. and one more question i am new to this one. what is php.ini. and .htaccess i dont have these files in my moodle folder. if those files needed can you post those files with data

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hello Jon,

Easy is good thank you for the response we use:

OS is Windows 2008
PHP Version is the integrated version with IIS7

Many Thanks,
Dewi

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)
OK,

I do not have any experience with IIS7 and Server 2008 - but I will try to help.

Can you first make a php page with the following code inside it and then attach the html page you get when viewing it?

<?php

phpinfo();

?>

This will let us see exactly where your php.ini file is being read from and how we need to go about changing the settings.

Jon

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hi Jon,

Thanks for your response - sorry could you do it one step at a time for me?

1. Make a php file - no prob's - does it matter what its called or in which directory its placed?

2. Attach the html page - sorry you've lost me here?

Sorry for lack of experience I am a newbie?

Thank you,
Dewi

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)
No problems Dewi;

1. Call it what ever you want and place it anywhere - lets say it is called info.php and you place it in the root of your webserver

2. Open the php file in yo0ur web browser http://your-server/info.php - then save the web page and attach it to your forum post here. Alternatively, if your server is web accessible; post the URL to the file here.

Jon

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hi Jon,

Cool thanks for the step-by-step...!

File is attached.

Or go to:

http://moodle.newporthigh.co.uk/info.php

Cheers,
Dewi

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)
OK Dewi,

As you are using IIS not Apache the .htaccess files will not take any effect.

To change your upload limits you need to edit the php.ini; which according to your phpinfo file is located at C:\Program Files\PHP\

1. post_max_size
3. max_execution_time
Change upload_max_filesize to the maximum size in MB you want to be able to upload;
Change post_max_size to slightly more (maybe a MB or two) than the ammount you set for upload_max_size;
Change max_execution_time to 600

Jon

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Ahhhh that'll be why I couldn't find php.ini in any of the Moodle directories..!!! I thought I was going mad - and now I know how to search the php directories quickly so thank you for that..!

Thank you - I will let you know when I have tested this I had to request increased access rights to get to the drive.

Pretty confident this will work so thank you very much - as I say I'll let you know when I've tested it...!

Cheers,
Dewi

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Jon-
Why make the post_max_size larger than the upload_max_filesize? I made both of mine the same but I don't know much. Just learning.

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

FYI, the first page to pop up on a Google search on "php post_max_size" is:

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Thanks Jon,

Just say worked a treat- thanks again...!

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)
That's OK Dewi. Glad to hear it worked.

Jon

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

I'm having a similar problem. I'm also new to this whole thing. I installed Moodle through a godaddy account. I've found my php.ini file in the html section and all it says is this:

register_globals = off
allow_url_fopen = off

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so

My question is, can I just edit that file to include the upload file sizes?

When I look for it through my Admin tabs I found a page that looks like the one above where you found it in his C drive. Mine's a little different, it says it's here:

/home/content/j/o/n/jonfila/html/php.ini

I can't get to it though through my ftp client as it says it doesn't exist.

I'll keep playing around in the meantime. Any help you could offer would be outstanding.

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Got it. Well it was easier than I thought.

I just added the lines directly to the php.ini file that was on the home page. When I went back to my Moodle page I was allowed to add larger files.

I decided just to try it and see what happened. I'm sure you'll be seeing more of me around here as I'm bound to screw up something else.

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hi Jon,

My Moodle site is also hosted by GoDaddy

I'm having trouble adding a SCORM file that is 21.6mb in size

I previous had trouble uploading large files and got arround this by using ftp to get the fuile uploaded into the Moodle directory.  So I can upload the file, but when I go to Add the SCORM as an activity to my course, I can choose it but as soon as I try to save it , Moodle just halts and all I get is a white screen.

My current php.ini settings are as follows:

register_globals = off
allow_url_fopen = off

expose_php = Off
max_input_time = 600
post_max_size = 128M
max_execution_time = 600
memory_limit = 128M

variables_order = "EGPCS"
extension_dir = ./
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so
session.bug_compat_warn=0

This file is located in the root html directory

Any suggestions?

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Hi Jon,

I hosted my moodle in virtual machine.Am facing problem in increasing the filesize.I did whatever steps you mentioned above.I have changed

1. post_max_size =60M
3. max_execution_time =600   in the following path Moodle\server\php\php.INI-RECOMMENDED File

But it is not reflected in Administration>Server> PHP info page.In last step you mentioned "refresh the phpinfo page",can you tell me how to refresh the page such that it will reflect changes in the phpinfo page?

Average of ratings: -
Re: Upload File Size Increase (Lunarpages Shared Hosting)

Your .htaccess suggestion solved my problem, on my shared hosting service

Which was...

When i added a php.ini file to any of the folders inside Moodle... it did not let me login

(Tags:  I was unable to login , cannot login into Moodle )

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

1) check the effective varialbles in http://yoursite/admin/phpinfo.php

2) not only php.ini take effect in

max_execution_time = 60
max_input_time = 120
memory_limit = 128M
post_max_size = 32M

3) check the files apache conf.d or site-enabled for
php_value post_max_size 32M

my problem was on 3rd point...

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

NP,

Once again I have run across a post that no one has answered in over a month. At least it's only a month and a half, and you're still enrolled, so maybe it's not too late.

This entire thread is a perfect example of a point I have tried to make before many times. People get a piece of advice that applies to a very specific environment, such as a particular web host or a version of PHP, etc. They find it works for them and they post it on this forum (or a related one) saying, "It worked for me, so it will work for you!" Of course, since other Moodlers have different environments, it doesn't work for them.

For example, AL's post consists almost entirely of a copy of a msg from his web host's (Lunarpages) helpdesk. It contains info that is applicable to that host and maybe some others, but certainly not all. To his credit, AL did not proclaim to the world that it will work for everyone. He said, "This may be helpful to someone." Good for him!

Likewise, you probably got the conf.d folder (directory) name from one of MG's posts in this thread. Note that he specifically said that this folder name is only used by certain OS's (operating systems) and not others. That's why he suggested finding out what OS 1 and 1 (ST's web host) was using.

As for the name site-enabled, I don't know where you got that from. lt does not occur in any post in this thread besides yours, nor does it occur in any Moodle doc page.

Now you said your problem was with the third point, but you didn't say what the problem with it was. I'm guessing that you didn't find a conf.d folder. There might not be one. Some hosts use that name and some don't. I have Moodle (with Apache) installed on Windows XP, and it doesn't use that name. The Apache configuration (.conf) files are in a folder named conf. In your case, it could be something else altogether. Or maybe your server isn't using Apache at all! It could be using another web server, such as IIS. That's why JW asked DJ what OS, PHP version and web server version he was running. It is also the reason the Moodle docs contain this bit of advice: Installation FAQ#System_information_needed_for_Installation_problems_forum.

Basically, the reason for checking the Apache configuration file(s) for the php_value directives is that they are an alternative way of specifying the values of those parameters, instead of in php.ini. The reason you need to look for them is, if you create or edit php.ini with the values you want, the Apache directives might interfere with them and you won't get the result you want. If your server is not using Apache or your Apache configuration is not using those directives, you don't need to worry about that.

RLE

Average of ratings: -
Re: Upload File Size Limit Increase is NOT effective

Amen

Average of ratings: -