title: When redeploying app on heroku PHP sessions disappear
body: <p>I have a Symfony app on Heroku which uses sessions (eg. to keep user logged in). </p>
  
  <p><br/><br/></p>
  
  <p>I have configured memcachier (output of <code>heroku addons</code> command):</p>
  
  <pre><code>Add-on                             Plan  Price
  ─────────────────────────────────  ────  ─────
  memcachier (memcachier-flat-XXXX)  dev   free
  </code></pre>
  
  <p><br/><br/></p>
  
  <p>I have also created file <code>.user.ini</code> in the root of my project with the following contents:</p>
  
  <pre><code>session.save_handler=memcached
  memcached.sess_binary=1
  session.save_path="PERSISTENT=myapp_session ${MEMCACHIER_SERVERS}"
  memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
  memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
  </code></pre>
  
  <p><br/><br/></p>
  
  <p>Also I have added to <code>composer.json</code> this requirement for <code>ext-memcached</code>:</p>
  
  <pre><code>  "require": {
          "php": "&gt;=5.3.9",
          "ext-memcached" : "*",
          "symfony/symfony": "2.7.*",
  </code></pre>
  
  <p><br/><br/></p>
  
  <p>So when I login to instance via <code>heroku run bash</code> and check if memcahed module is installed - it all seems fine (also phpinfo() executed served via nginx and php5-fpm returns same configuration values)</p>
  
  <pre><code>~ $ php -i | grep memcache
  /app/.heroku/php/etc/php/conf.d/110-ext-memcached.ini
  memcached
  memcached support =&gt; enabled
  libmemcached version =&gt; 1.0.18
  memcached.compression_factor =&gt; 1.3 =&gt; 1.3
  memcached.compression_threshold =&gt; 2000 =&gt; 2000
  memcached.compression_type =&gt; fastlz =&gt; fastlz
  memcached.serializer =&gt; php =&gt; php
  memcached.sess_binary =&gt; 0 =&gt; 0
  memcached.sess_connect_timeout =&gt; 1000 =&gt; 1000
  memcached.sess_consistent_hash =&gt; 0 =&gt; 0
  memcached.sess_lock_expire =&gt; 0 =&gt; 0
  memcached.sess_lock_max_wait =&gt; 0 =&gt; 0
  memcached.sess_lock_wait =&gt; 150000 =&gt; 150000
  memcached.sess_locking =&gt; 1 =&gt; 1
  memcached.sess_number_of_replicas =&gt; 0 =&gt; 0
  memcached.sess_prefix =&gt; memc.sess.key. =&gt; memc.sess.key.
  memcached.sess_randomize_replica_read =&gt; 0 =&gt; 0
  memcached.sess_remove_failed =&gt; 0 =&gt; 0
  memcached.sess_sasl_password =&gt; no value =&gt; no value
  memcached.sess_sasl_username =&gt; no value =&gt; no value
  memcached.store_retry_count =&gt; 2 =&gt; 2
  memcached.use_sasl =&gt; 1 =&gt; 1
  Registered save handlers =&gt; files user memcached 
  </code></pre>
  
  <p><br/><br/></p>
  
  <p>However when inspect instance via <code>heroku run bash</code> and running <code>php -i | grep session</code> you can see that <strong>session.save_handler</strong> is still <code>files</code> despite configuring in <code>.user.ini</code>  <code>session.save_handler = memcached</code></p>
  
  <pre><code>session
  session.auto_start =&gt; Off =&gt; Off
  session.cache_expire =&gt; 180 =&gt; 180
  session.cache_limiter =&gt; nocache =&gt; nocache
  session.cookie_domain =&gt; no value =&gt; no value
  session.cookie_httponly =&gt; Off =&gt; Off
  session.cookie_lifetime =&gt; 0 =&gt; 0
  session.cookie_path =&gt; / =&gt; /
  session.cookie_secure =&gt; Off =&gt; Off
  session.entropy_file =&gt; /dev/urandom =&gt; /dev/urandom
  session.entropy_length =&gt; 0 =&gt; 0
  session.gc_divisor =&gt; 1000 =&gt; 1000
  session.gc_maxlifetime =&gt; 1440 =&gt; 1440
  session.gc_probability =&gt; 1 =&gt; 1
  session.hash_bits_per_character =&gt; 5 =&gt; 5
  session.hash_function =&gt; 0 =&gt; 0
  session.name =&gt; PHPSESSID =&gt; PHPSESSID
  session.referer_check =&gt; no value =&gt; no value
  
  
  
  session.save_handler =&gt; files =&gt; files
                          ^^^^^^^^^^^^^^    WTF ???
  
  
  session.save_path =&gt; no value =&gt; no value
  session.serialize_handler =&gt; php =&gt; php
  session.upload_progress.cleanup =&gt; On =&gt; On
  session.upload_progress.enabled =&gt; On =&gt; On
  session.upload_progress.freq =&gt; 1% =&gt; 1%
  session.upload_progress.min_freq =&gt; 1 =&gt; 1
  session.upload_progress.name =&gt; PHP_SESSION_UPLOAD_PROGRESS =&gt; PHP_SESSION_UPLOAD_PROGRESS
  session.upload_progress.prefix =&gt; upload_progress_ =&gt; upload_progress_
  session.use_cookies =&gt; On =&gt; On
  session.use_only_cookies =&gt; On =&gt; On
  session.use_strict_mode =&gt; Off =&gt; Off
  session.use_trans_sid =&gt; 0 =&gt; 0
  </code></pre>
  
  <p>So I wonder why isn't <code>.user.ini</code> configuration not taking effect with real <code>php.ini</code> configuration?</p>