title: Invoke OpenSSL command via shell_exec() in PHP
body: <p>When I execute:</p>
  
  <pre><code>openssl_decrypt(
      base64_decode(file_get_contents('/path/to/file')),
      'aes-256-cbc',
      $key,
      OPENSSL_RAW_DATA,
      $iv
  );
  </code></pre>
  
  <p>OpenSSL decrypts my file perfectly. However, when I execute:</p>
  
  <pre><code>shell_exec('openssl enc -aes-256-cbc -base64 -d -A -p -K ' . $key . ' -iv ' . $iv . ' -in /path/to/file -out /path/to/dest');
  </code></pre>
  
  <p>The destination file is not created.</p>
  
  <p>Does anyone know what could be wrong?  My client wants to be able to upload large files up to 2GB, and loading that much data into a PHP variable seems like an exceedingly bad idea.</p>
  
  <p>Edit:</p>
  
  <p>With bin2hex i get a seemingly sane command of:</p>
  
  <pre><code>openssl enc  -aes-256-cbc -base64 -d -A -p -K 64343438343165333635663434663262633036636235656462383238356239303763373365353633 -iv abdd099c7bac8b514089d8c901c8395c -in /usr/www/vault/new/d71fd708181573c5f92c8f500ddcb399/787 -out /tmp/decrypted/57574484b684c
  </code></pre>
  
  <p>But with pack I get:</p>
  
  <pre><code>openssl enc  -aes-256-cbc -base64 -d -A -p -K M�&gt;VO���[ދ��  �7^6 -iv ⬧⬧⬧⬧⬧⬧⬧ -in /usr/www/vault/new/d71fd708181573c5f92c8f500ddcb399/787 -out /tmp/decrypted57574484b684c
  </code></pre>