Upload Size PHP - php

I am developing a web application which will allow the administrator to upload a file and its max size is 500M.
I have changed the post_max_size = 500M and upload_max_filesize = 500M from 32M but the funny thing is that it does not allow me to upload files greater than 32M still.
I have restarted the server and everything and still cant get to upload a large file.
Is there any other setting i should change to allow me to upload the file?
I am not going to process the file in memory but move it to the tmp folder and than process from there with move_uploaded_file so memory_limit i am assuming that is not going to be affected.
It is a simple form and as i recall if the limit is exceeded in the $_FILES superglobal array i should see something in the error element of the array but instead i get an empty array.
EDIT: I am modifying the php.ini settings but from phpinfo i am still getting the sizes of 32MB. And the php error log says that obviously i am exceeding 32MB
Can you please help me out.
Thanks

Chech phpinfo() on a web page, see which php.ini is loaded. You could be editing the wrong file.
Sometimes different ini files get loaded for command line and apache server use

I fount out what the problem is:
I am using MAMP as a developing server and MAMP has templates which override the original every time the server starts (a stupid thing IMO) so you need to change the template for it to take effect!
The template can be found under /Applications/Mamp Pro/Contents/Resources
And there many php ini files for every version will be found.
Hope this helps to the next one!

Related

plupload example gets 103 error

I am playing with plupload 2.1.3 and can't get it to complete an upload using their custom example. I get a 103, unable to move uploaded file. If I look in the upload directory I see the file I tried to upload listed as test.png.part. My php.ini lists /tmp as my upload_tmp_dir.
From this I gather that the permissions are correct (I even set everything to 777 temporarily -- go difference).
This is a fairly newly configured server so it may not be related to plupload.
You have to check your PHP configurations on php.ini file.
If your upload is constantly being interrupted you either need to increase the maximum upload size or the time before your PHP script times out. Check this variables:
post_max_size
upload_max_filesize
max_execution_time
You can either increase in your PHP configuration file or increase in your script using the ini_set function. Check the manual for more details. PHP Manual

Joomla 3.2 Increase the upload_max_filesiz

I am trying to download this template on Joomla 3.2 extension manger :
http://scriptmafia.org/templates/115622-yt-moustache-yootheme-for-joomla-25-32.html
but every time I upload it, it gives me this error:
There was an error uploading this file to the server.
I have read articles about "increase the upload max size in the php.ini file".
I have tried to find this file in the administrator files section in Joomla, but it is "not found".
So how can I fix this problem? It has not happened for this template only, it has happened for several. So I am almost sure it is due to the upload size.
Edit your php.ini and increase *upload_max_filesize* and *post_max_size*; then restart your web server.
If you don't know where is your php.ini, create a php file to discover: echo php_ini_loaded_file();
The returned path is where your php.ini is located.
EDIT
Well, seems like you have a permission error and not size limit. Try to change permissions of the temp Joomla folder (you can see/configure it on Global Configuration > System).
If you are using XAMPP , php.ini file will be located in c:\XAMPP\php folder. Find the file and increase file upload size there.
If you are using WAMP, You can find ini file in /wamp/bin/php directory.
The location may vary from one OS to another.
You can follow this link:
http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/
You can call in your script ini_set function and change values, which have been stored in php.ini (any changes has affected only for current script, but not for global settings)
ini_set('post_max_size', "%value in MiB for example 16M%")
ini_set('upload_max_filesize', "%value in MiB for example 16M%")
You can read more about it at php.net
If you can't resolve the PHP limitation easily, an alternative is to FTP the installation file to the /tmp folder and in Extension Manager -> Install, use the "Install from Directory" option instead.
Had the same issue for the longest time, none of the answers helped. Found that if you are using GoDaddy, and go to your CPanel, scroll down to Software, then choose PHP version, switch to PHP Options, there you can change your upload file size. Hope this helps, took me forever to find it.
Some people might be having a issue with the memory allocation portion of php.ini file "memory_limit" the default for me was 128mb and i was attempting to upload nearly 300mb and it hit that roadblock. After changing the default value to 512mb and restarting the server i was able to get past this limit.
How to change post_max_size and upload_max_filesize in a local installation of Joomla 3 in XAMPP
You can check the php setting in two places – site’s backend under system information – go to php information. Or on browser go to localhost and click on phpinfo. You’ll find the post and upload part under “Core” heading.
Go to c:\xampp\php\
Find the file php.ini
Open php.ini in notepad
Find post_max_size and change value to 20M
Find upload_max_filesize and change value to 20M
Save the file
Logout out of your site backend.
Turn off apache and mysql on xampp and quit
Restart xampp as administrator
Turn on apache and mysql
Open browser and go to localhost
Open phpinfo and search for upload_max_filesize and post_max_size.
Confirm that changes are registered.
This can also happen with the following suhosin setting:
suhosin.upload.disallow_binary = On
Setting it to off temporarily allows you to upload zip files
If you use CPanel, search for PHP version (in the Software section) and click on it, then click on 'switch to PHP Options', the options will display then look for 'upload_max_filesize' and click on the value to change it. Do the same for 'post_max_size'.

Acquia Drupal 7 - php upload limit won't change

I'm working with acquia-drupal 7 (just localhost for now), inside Microsoft WebMatrix.
I can't get my php upload limit to increase from the default 2MB. Having googled around I have done the following:
added to every existing htaccess:
php_value upload_max_filesize 10M
php_value post_max_size 10M
created php.ini file in every dir that had an htaccess (no php.ini files existed anywhere) containing the following:
upload_max_filesize = 10M
post_max_size = 10M
Restarted the site (through the Webmatrix GUI)
No apparent change whatsoever after any of this - my site still has the 2MB upload limit.
Thoughts?
The reason your changes are not taking affect are because you just created a php.ini file anew, rather than finding the one that is being used.
By definition, since you just created it, it won't be the one that exists in your php directory. :-)
But don't worry! There's an easy way to find the correct php.ini file that your site is using:
Go to /admin/reports/status on your drupal site. Here you will see information about which version of php and apache you're using, etc.
The line for 'PHP' on that page should have both the version of php you're using (something like 5.3.6) and a 'more information' link
Click on that link and you should be able to see detailed information about the php installation on your machine.
Find the line called 'Configuration File (php.ini) Path' on that screen and navigate to that to update it.
Just like you already knew, make sure you restart your server after any changes. :-)
Let us know if this fixes your problem!
Have you ever ran into a problem where you needed to upload relatively large files and still want to be able to manage these from the Drupal 7 administrative interface? If so, you may run into a situation like the one below:
You will notice the 12 MB text stating that we can only upload files that are 12 MB and under. In this case I needed this number to be a little bigger.
In order to do this you will need to modify your PHP settings in your php.ini file.
Note: You should make sure you know what you are doing and understand the consequences of increasing this number. In my case this is on a site that only users that I trust will be uploading files. If you allow any user to upload files, increasing this number can add an increased load on the server and possible eat up your disk space pretty quickly.
Now that you have been warned, here is how I was able to do this. I first found the php.ini file on my system. I am on an Ubuntu server so I was able to get to edit mine using vim like so:
vim /etc/php5/apache2/php.ini
Change the upload_max_filesize setting
The first step was to find the upload_max_filesize setting from 12MB to 30MB.
Change:
To:
Change the post_max_size setting
You may also need to modify the post_max_size setting. I changed the post_max_size php.ini setting from 20MB to 30MB.
Change:
To:
Restart Apache
You should check phpinfo to make sure your php.ini which you edited is the correct one.

Uploading files over 20MB via PHP to mySQL (GoDaddy Unix)

I am trying to modify existing PHP code, mySQL database and server settings (php.ini and .htaccess) at GoDaddy to allow for uploads in excess of 20MB (new limit will be 30M). Currently, when I upload anything larger than 8MB, the PHP code apparently executes (I know this because there is an update query that shows the result of the upload), no errors are reported from PHP, mySQL or the server, but nothing is uploaded either.
I have set the following parameters in the php.ini file:
memory_limit = 100M
post_max_size = 30M
file_uploads = On
upload_max_filesize = 30M
max_execution_time = 0
max_input_time = 0
my .htaccess file says
LimitRequestBody 0
My PHP code works well for files under 8 MB but I am having trouble figuring out why anything over that is not happening at all. I checked the file upload location (I physically upload the file to the server's filesystem before I insert/update the data into mySQL) and the files over 8MB never make it. So my guess is that this is where it fails.
Anyone have an idea what I am missing?
Thanks in advance for any input.
M
EDIT:
OK - feel free to award me the dufus badge! I am working in php5. The friggin php.ini file (at least on this server - don't know if this is true of other servers) only works for versions below 5. For version 5 you have to use php5.ini.
As per the GoDaddy support document: http://help.godaddy.com/article/1475
On MySQL side, there is max_allowed_packet variable that limits size of single request, e.g the size of SQL query. You can set it to 50MB or so in your case.
Use a phpinfo file to check for definite what the limits are. Just make a file with the following contents and call it whatever you like (with php extension...):
<?php phpinfo(); ?>
According to this post (http://wordpress.org/support/topic/upload_max_filesize-increase-on-godaddy) you need to add another line to your .htaccess:
suPHP_ConfigPath php.ini

changing php.ini settings on heart internet

I am trying to upload large files through my cms and was wondering how to change the php.ini file for heart internet.
Is this possible in shared hosting, if not are there any other work arounds?
Thanks in Advance
To override settings all you need to do is create either a php.ini or php5.ini file (if you are running PHP5) in your root directory. Then you can change settings like this:
upload_max_filesize = 20M ;
post_max_size = 20M ;
max_execution_time = 60 ;
This gives you maximum file size of 20MB and 60 second timeout.
As long as you keep this size within the allowed limits on your account, you can use this to increase the default size - which is 5MB.
It depends on whether your web hosting company allows you to override certain PHP settings or not. It might be possible to change some values but not others.
Secondly, the process for overriding settings differs depending on whether your hosting is IIS or Apache. If its Apache, try adding these two lines to your .htaccess file:
php_value upload_max_filesize 8M
php_value post_max_size 8M
This .htaccess file should do to the directory where your php upload script resides, or higher. I'd rather put it in the root directory.
Once done, create a php page containing this code:
<?php phpinfo( ); ?>
Compare the Local Value and Master Value of these settings to see if the changes are in effect.
There is no way to upload files over 50MB without breaking your terms and getting your account shutdown.
However if the terms were different, you could split the file into parts and join them together on the server side.
I moved away from heart internet and got my own server for this exact reason as they wouldn't even let me pay a premium to get the restriction removed (restricted from there end I think)
If it is shared hosting you probably won't be able to, I have also discovered that you cannot use ini_set to set the correct settings because the file upload occurs before your script is executed. So if you want to accept large files via a form to a PHP script you have to use php.ini.
You might be a work around though, you could use an open FTP account, upload large files form there and code a bit of script to ask the user what file they have uploaded, then you can manipulate (move / rename) to your hearts content.

Categories