max file upload limit - nginx

I have a form that has a file uploader
I just want to show a message containing file size error message when the file is too large but i have the following scenario :
when the max-file exceeds the nginx it auto respond with nginx error message and while i'm uploading it by ajax i can show nothing
I tried increasing the nginx file limit and restricting the php.ini size limit
it went so perfect because the php return a status code describing the error and from it I can show my own message, the problem with this way is that the php.ini has the following two attributes:
post_max_size = 15M
upload_max_filesize = 10M
if the max_post_size was exceeded (16M) the file is ignored and the back end has no idea if it was an empty file or ignored while if it was only exceeds the upload_max_filesize (12M) the error status is available
so how can I by pass the max_post_size ?

it was solved by doing the following ...
if(!$file && Yii::app()->request->isPostRequest && !$_POST){
return $this->render('upload_error', array('errors'=>"File too large. Maximum file size is 10 MB)"));
}
on the application layer

Related

How do I save a WordPress website into different server?

I have been having trouble saving a WordPress website into a different server and keep getting an error when opening it in my browser.
Fatal error:
Allowed memory size of 67108864 bytes exhausted (tried to allocate
32245 bytes) in
/home/clemente1234/public_html/clementeghuerta.com/green-banker-2/wp-includes/functions.php
on line 347
Does anyone know what I am doing wrong?
The error you are seeing can typically be resolved by adjusting how much memory is being allocated to WordPress. In your wp-config.php file, try modifying/adding this line to an appropriate amount of memory. The current limit seems to be at about 67M, so maybe something like:
define( 'WP_MEMORY_LIMIT', '128M' );
It seems you only have 64M.
If you have access to your php.ini, increase the max memory size..
ini_set('memory_limit', '128M');
Or even in your .htaccess
php_value memory_limit 128M

Wordpress wpadmin : Fatal error: Allowed memory size of 536870912 bytes exhausted

I am using woocommerce on my wordpress site. I wanted to filter out specific products by category. When I clicked the filter button, this error occurs:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in /..../wp-includes/wp-db.php on line 1841
I checked and executed this : http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/
by adding define( 'WP_MEMORY_LIMIT', '256M' ); on wp-config, but still error occurs
Also, I don't have iThemes Security installed on my PC as seen on this link(though I installed before, I just only uninstalled)
WordPress Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 77 bytes) in wp-includes/wp-db.php on line 1832
FYI, I only have more than 10k of total products on my database.
Does anybody know?
To debug, you need to check how much memory php.ini allows the php to use.
create a phpinfo.php file under your website, put phpinfo() in:
<?php phpinfo(); ?>
Visit corresponding page and check PHP memory_limit number. If its too small, you can increase it by editing the php.ini. The path informaion of php.ini is also displayed on http://your.domain/phpinfo.php URL.
Then, find memory_limit = line:
memory_limit = 1024M ; /* Change the 1024M to your needs */
In addition, you may want to try to display less product in a single page. This may save some memory for you.

Fatal error, Allowed memory size exhausted

I have been getting a fatal error message, Allowed memory size of 67108864 bytes exhausted, I have upgraded memory to no avail.
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes)
in /home/content/85/7866685/html/wp-includes/wp-db.php on line 1383
This is a very typical WordPress issue; you should search first for existing answers before asking the question, such as " Allowed memory size of "
Using FTP you can try increasing the memory for PHP and Wordpress in several different ways:
1) You can edit the memory_limit line in your php.ini (if you have access to that file) to increase memory to 64M:
memory_limit = 64M;
2) If you can't get to the php.ini file, add this line at the top of your .htaccess file:
php_value memory_limit 64M
If that doesn't work or throws a "500 Internal Server Error", delete the line from .htaccess.
3) Try adding the 'define" line below in your wp-config.php file a few lines of white space below the opening <?php
define('WP_MEMORY_LIMIT', '64M');
If none of those work, your host probably doesn't allow memory allocation overrides. You're stuck with what they give.

Changing Permalink Settings in Wordpress gives "Fatal error: Out of memory"

I tried to change the URL structure of my Wordpress site. I am getting following error
"Fatal error: Out of memory (allocated 31981568) (tried to allocate 1111781 bytes) in ../wp-includes/wp-db.php on line 774"
I researched in internet and I got this solution:
1. Try adding this line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '64M');
2. If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
3. If you don't have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M
4. Talk to your host.
Nothing worked for me, I did not try the second option since I do not have access to php.ini file.
My Question is why changing an simple URL cause this issue? Is this because of cache or some thing?
Any help would be greatly appreciated.
WordPress needs RAM. Talk to your host and ask them how much your account gets and ask for more. You might have to change hosts.

drupal POST Content-Length exceeds the limit

hi i got list of warning regarding file size when i try to upload an image using file upload.
"POST Content-Length of 12223490 bytes exceeds the limit of 8388608 bytes in Unknown on line 0"
My question is how to avoid displaying warning messages (i got 5 warnings). I dont want to increase the file size limit just handle it with showing single warning msg to user rather than a list
Check at php.ini:
post_max_size and upload_max_filesize
You can avoid displaying the warnings by settings the display_errors setting to false. Just make sure you log the errors so you can troubleshoot problems later.

Resources