Raise Memory Limits for large STL Uploads for Instant 3D Printing Quotes

If you are getting this error, then you have a php memory limit issue, which can be easily fixed.The Quote Calculator plugin have a php upload limit and post max size limit. These limits prevent anyone from uploading insanely huge files that can cause errors in your server. Standard php upload limits are normally 2mb and post max size is 8mb. These figures are good for small projects, but if you normally receive large projects the calculator would be problematic with those limits.

There are various means to raise the php limits. Depending on your hosting set up, it can easily done by these three methods.

  1. php.ini
  2. .htaccess
  3. wp-config.php
  4. Calling your hosting provider to have them raise your php limits in the server side.

In your order page, you should see a php.ini file and you will see these figures

upload_max_filesize = 100M

post_max_size = 200M
memory_limit = 300M
file_uploads = On
max_execution_time = 400

Now the M is for megabytes. Max_Execution_Time is measured in seconds, so 400 seconds is 6.66 minutes. The larger the file the more time it may require for calculation. Therefore, having a nice gap for execution time will prevent connection time outs. You can edit the post_max_size and memory_limit figure to anything you want. Since the standard is normally 2mb for uploads and post_max_size is 8mb, your calculator will be limited to small to medium size uploads.

Now, memory_limit controls the upload limit and post_max_size controls the file post. These two figures are completely different and just because you raise the memory limit to 100M does not mean the calculator will spew out a quote. Therefore, you must raise post_max_size to be equal or greater  than your memory_limit. Not doing this will result to the stl file being uploaded to your server, but the php settings will prevent the calculator to provide quotes.

Take the php.ini with the preset figures and upload to your /wp-admin folder.

 

Now test a large upload and see if it works. If it works, then you did a good job and now your calculator can do large file calculations.

 

If php.ini did not do the trick, then let’s try the .htaccess method

 

go to your .htaccess file which can be located in your home folder for your site. WARNING: changing any of the figures in .htcaccess file can result to your site getting the white screen of death. Therefore, make a back up of your .htaccess just in case.

 

here are the figures you should write after </IfModule> and before # END WordPress

 

php_value upload_max_filesize 1000M
php_value post_max_size 100M
php_value memory_limit 3000M
php_value max_execution_time 180
php_value max_input_time 180

Now test again, if this solved your problem then congrats. If not, then its one last trick before you have to call your hosting provider.

 

wp-config.php

go to your home folder and find wp-config.php and paste this figure

define(‘WP_MEMORY_LIMIT’, ‘100M’);

before ?>

If that does not work, then contact your hosting provider and ask them to raise your:

 

  1. php post_max_size
  2. php memory_limit
  3. max_execution_time
  4. max_input_time

Depending on your hosting plan or your server plan, you may need to upgrade your plan in order to accomodate the higher php upload and post size limit.