changing php.ini settings on heart internet - php

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.

Related

Upload Size 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!

Post method issue, I can't upload more than 8 MB files using php

I can't upload more than 8 MB files in PHP. I have added below lines in .htaccess file.
php_value upload_max_filesize 2048M
php_value post_max_size 2048M
This is working on localhost but not working on live server. I have contacted the support team of server and ask them to give rights to edit php.ini file but said you haven't any permission to update php.ini file.
Please help me regarding this issue.
Your webhost probably does not allow php.ini to be overridden by .htaccess. This is common on shared hosting. If you need to do large uploads you need to find a host that supports it or get a VPS.
There are some upload libraries which support partial/chunked upload, you can circumvent hoster restrictions with that, cause it uses multiple requests to upload one file. I use something like https://github.com/blueimp/jQuery-File-Upload most of the time when i have to handle big uploads.

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.

1GB file upload using php

I am trying to upload a file of 1GB size using php script and it works perfectly if file size is less than 20MB, but when I increase the file size than after pressing upload button on website, it uploads the file (I guess as it takes few minutes) and after that, instead to execute upload.php, my firefox asks me to download upload.php, so I guess, file is being uploaded but my php script fails to execute.
Also after searching in google I found following settings for php.ini which I made and my php_info() function shows me that settings have been changed..
/*php.ini start*/
memory_limit = 512M
post_max_size = 15000M
file_uploads = On
upload_max_filesize = 15000M
max_input_time = 20000
max_execution_time = 20000
session.gc_maxlifetime = 20000
/*php.ini end*/
The limit on file size uploads is limited by a LOT more than just PHP. PHP has its limits, Apache has its limits, many web services have their own limits, and then you have the limit on the /tmp directory size which could be set by user permissions on a shared host. Not to mention just running out of hard drive space!
Your php.ini looks good, but as was already suggested- check the LimitRequestBody in Apache and make sure your web service allows this.
One common solution when you need to upload very large files is to use Flash or Java on the client-side since these have access to the client's actual file system. The Flash/Java can then break the file into small pieces which are sent one at a time and re-assembled on the server side. This has multiple benefits. First, you can resume broken downloads. Second, you don't have to worry about any scripts timing out. Third, it bypasses any possible file system limits that may be in play from PHP, Apache, web services, or other sources.
post_max_size = 15000M should be higher than upload_max_filesize = 15000M.
It can be either post_max_size = 15001M. I've increased it to 1 more.
Check that your web server also allows such large uploads. On Apache the setting is LimitRequestBody. This limit is be applied long before PHP ever enters the picture and cannot be changed/overriden from within PHP.

PHP Uploads Limit for Scanning?

I read somewhere that the upload limit for php is about 2MBs. Does this still apply if I am asking a user to upload a file to the server to scan through and convert to a string? If so how do I get around this?
The application for this is a scanner type deal where users would be able to upload a code file, and this php application would scan through the code and look for certain comments to document and write to a documentation file.
The upload limits are configured in the php.ini file, see this: http://www.radinks.com/upload/config.php
Yes it would apply to any file that is being uploaded by the user, regardless of what your server side app does with it. :)
The upload limit can be changed by modifying the settings in php.ini file.
Yes it would (assuming it's a POST). You get around it by changing your php config.
PHP has two limits that apply in this case. Both are ini options: upload_max_filesize and post_max_size
I believe the upload_max_filesize defaults to 2 MB. (The post_max_size setting has to be larger than upload_max_filesize).
See: Core php.ini directives

Categories