title: Amazon EC2 Ubuntu Instance Maximum File Upload Size
body: <p>I was given an Amazon EC2 Ubuntu Instance. We are task to create a web application that includes uploading a client video. I have created a file upload application in my localhost and it is working fine. When I migrated the code to the virtual host server, I cannot upload any video and even any file that exceeds <code>2Mb</code>. I tried editing the <code>php.ini</code> setting <code>upload_max_filesize</code> to <code>50M</code> and post_max_size to <code>1000M</code>.</p>
  
  <p>After restarting Apache so many times, the update is not reflected in my <code>phpinfo()</code> information but changes were saved in my <code>php.ini</code> file.</p>
  
  <p><a href="https://i.stack.imgur.com/7Nf5c.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7Nf5c.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/GCPTe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GCPTe.png" alt="enter image description here"></a></p>
  
  <p>I was suspecting that the Amazon EC2 instance given to me has a file upload restrictions but Im not sure if Im right. If I was wrong, how can I override the configuration below? Any help would be very much appreciated.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I even made sure that I was editing the correct configuration file. Below are the screen shots:</p>
  
  <p><a href="https://i.stack.imgur.com/DnCMM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DnCMM.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/3xOYx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3xOYx.png" alt="enter image description here"></a></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I tried following what is said in the <a href="https://forums.aws.amazon.com/message.jspa?messageID=410421#" rel="noreferrer">link</a> with no luck. I have a lot of questions in mind about the link like:</p>
  
  <ol>
  <li>What does <em>tomcatchesides</em> mean about <code>S3 bucket</code>? I uploaded the config file in <code>/var/www/html/.ebextensions</code> . Am I doing the right thing?</li>
  </ol>
  
  <p>My <code>zzz.ini</code> contains the code below and I place it in <code>/etc/php.d/zzz.ini</code>:</p>
  
  <pre><code>[php]
  post_max_size = 1000M
  upload_max_filesize = 50M
  </code></pre>
  
  <p>My <code>myconfigfile.config</code> was located in <code>/var/www/html/.ebextensions/myconfigfile.config</code> and contains the code below:</p>
  
  <pre><code>files:
    "/etc/php.ini":
      mode: "000644"
      owner: root
      group: root
      source: http://mybucketname.s3.amazonaws.com/php.ini
  
    "/etc/php.d/zzz.ini":
      mode: "000644"
      owner: root
      group: root
      source: http://mybucketname.s3.amazonaws.com/zzz.ini
  </code></pre>
  
  <p>How to know the bucket name of my instance?</p>
  
  <p>I also copied my <code>php.ini</code> from <code>/etc/php/7.0/apache2/php.ini</code> to <code>/etc/php.ini</code> and restarted apache. Still no changes. Am I doing the right thing?</p>
  
  <p>UPDATE:</p>
  
  <p>I ask for the bucket name to the person who gave me the EC2 instance and her reply was. </p>
  
  <blockquote>
    <p>Yes, you were given access to an EC2 instance. S3 is a different
    service provided by Amazon and that's not automatically available to
    EC2 instances. We can create a bucket in S3 for you but it may no
    longer be needed.</p>
    
    <p>The EC2 instance has around 8GB storage space. You should be able to
    store multiple videos greater than 2MB in the EC2 file system and
    access them directly.</p>
    
    <p>Using S3 for file uploads is a good idea especially when your software
    goes to production. However, to simplify the setup, please use the
    file system instead to store the videos.</p>
  </blockquote>
  
  <p>UPDATE :</p>
  
  <p>Running the following commands:</p>
  
  <pre><code>php -i | grep -i max_size
  </code></pre>
  
  <p>yields: <strong><em>post_max_size => 1000M => 1000M</em></strong></p>
  
  <pre><code>grep -ir "max_size" /etc/php/7.0/apache2/conf.d/
  </code></pre>
  
  <p>yieds nothing.</p>
  
  <pre><code>grep -ir "max_size" /etc/php/7.0/
  </code></pre>
  
  <p>yields</p>
  
  <pre><code>/etc/php/7.0/fpm/php.ini:post_max_size = 1000M
  /etc/php/7.0/apache2/php.ini:post_max_size = 1000M
  /etc/php/7.0/cli/php.ini:post_max_size = 1000M
  </code></pre>
  
  <p>My <code>phpinfo()</code> can be access through this <a href="http://18.236.72.77/info.php" rel="noreferrer">link</a> </p>