title: TWIG and "unexpected T_FUNCTION" which return a server 500 error with hostmonster.com
body: <p>I have this code which works on my localhost and with one.com web hosting. But when uploaded in hostmonster.com's ftp, the browser return a 500 error. 
  I'm using TWIG as template engine.</p>
  
  <p>Here are the link to the pages: </p>
  
  <ul>
  <li><p>doesn't work(hostmonster.com): <a href="http://armourertech.com/produit.php" rel="nofollow">http://armourertech.com/produit.php</a></p></li>
  <li><p>work(one.com): <a href="http://chacartz.fr/autre/armourer/produit.php" rel="nofollow">http://chacartz.fr/autre/armourer/produit.php</a></p></li>
  </ul>
  
  <p>The technician at hostmonster.com told me the error is on the line 12: </p>
  
  <p><code>$walkdir_gearbox = new Twig_SimpleFilter ( 'walkdir_gearbox', function ($path_01)</code></p>
  
  <p>Code:</p>
  
  <pre><code>&lt;?php 
  
  require "twig.php";
  require "nav.php";
  $head_title = "armourertech";
  $nav['produit'] = "actuel";
  $keywords = "";
  $description = "";
  $robots = "index, follow";
  $googlebot = "index, follow";
  
  
  $walkdir_gearbox = new Twig_SimpleFilter ( 'walkdir_gearbox', function ($path_01) {//&lt;-line 12
      $path_01 = "img/x-hightech/01gearbox";
      $d = new DirectoryIterator($path_01);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/01gearbox/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/01gearbox/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_gearbox($f-&gt;getPathname());
          }
      }
  });
  
  $walkdir_gearboxcnc = new Twig_SimpleFilter ( 'walkdir_gearboxcnc', function ($path_02) {
      $path_02 = "img/x-hightech/02fabrication-gearbox-cnc";
      $d = new DirectoryIterator($path_02);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/02fabrication-gearbox-cnc/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/02fabrication-gearbox-cnc/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_gearboxcnc($f-&gt;getPathname());
          }
      }
  });
  
  $walkdir_piston = new Twig_SimpleFilter ( 'walkdir_piston', function ($path_03) {
      $path_03 = "img/x-hightech/03piston-gear-set";
      $d = new DirectoryIterator($path_03);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/03piston-gear-set/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/03piston-gear-set/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_piston($f-&gt;getPathname());
          }
      }
  });
  
  $walkdir_cylindre = new Twig_SimpleFilter ( 'walkdir_cylindre', function ($path_04) {
      $path_04 = "img/x-hightech/04tete-cylindre";
      $d = new DirectoryIterator($path_04);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/04tete-cylindre/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/04tete-cylindre/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_cylindre($f-&gt;getPathname());
          }
      }
  });
  
  $walkdir_hopup = new Twig_SimpleFilter ( 'walkdir_hopup', function ($path_05) {
      $path_05 = "img/x-hightech/05hopup";
      $d = new DirectoryIterator($path_05);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/05hopup/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/05hopup/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_hopup($f-&gt;getPathname());
          }
      }
  });
  
  $walkdir_autre = new Twig_SimpleFilter ( 'walkdir_autre', function ($path_06) {
      $path_06 = "img/x-hightech/06autres";
      $d = new DirectoryIterator($path_06);
      foreach($d as $f)  {
          if(
              preg_match('/(\.gif|\.png|\.jpe?g)$/', $f-&gt;getFilename())
          ) {
             list($w, $h) = getimagesize($f-&gt;getPathname());
              $file = basename($f, ".jpg");
              echo "&lt;figure itemprop=\"associatedMedia\" itemscope itemtype=\"http://schema.org/ImageObject\"&gt;&lt;a href=\"img/x-hightech/06autres/".$f-&gt;getFilename() . "\" itemprop=\"contentUrl\" data-size=\"".$w."x".$h."\"&gt;&lt;img src=\"img/x-hightech/thumbs/06autres/".$f-&gt;getFilename() . "\" itemprop=\"thumbnail\" alt=\"".$file." - ARMOURERTECH\" /&gt;&lt;/a&gt;&lt;figcaption itemprop=\"caption description\"&gt;".$file."&lt;/figcaption&gt;&lt;/figure&gt;";
          } elseif($f-&gt;isDir() &amp;&amp; $f-&gt;getFilename() != '.' &amp;&amp; $f-&gt;getFilename() != '..') {
              walkdir_autre($f-&gt;getPathname());
          }
      }
  });
  
  $twig = new Twig_Environment($loader);
  $twig-&gt;addFilter($walkdir_gearbox);
  $twig-&gt;addFilter($walkdir_gearboxcnc);
  $twig-&gt;addFilter($walkdir_piston);
  $twig-&gt;addFilter($walkdir_cylindre);
  $twig-&gt;addFilter($walkdir_hopup);
  $twig-&gt;addFilter($walkdir_autre);
  echo $twig-&gt;render('produit.html', array(
      'nav' =&gt; $nav,
      'head_title' =&gt; $head_title,
      'keywords' =&gt; $keywords,
      'description' =&gt; $description,
      'robots' =&gt; $robots,
      'googlebot' =&gt; $googlebot
      )
  );
  
  ?&gt;
  </code></pre>
  
  <p>then I put this line in the html:</p>
  
  <pre><code>{{ 'twig' |walkdir_gearbox }}
  </code></pre>
  
  <p>Here are the last lines of the error.log file</p>
  
  <pre><code>[15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/imagick.so' - /usr/php/54/usr/lib64/php/modules/imagick.so: undefined symbol: zend_new_interned_string in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/http.so' - /usr/php/54/usr/lib64/php/modules/http.so: undefined symbol: zend_new_interned_string in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: magickwand: Unable to initialize module
  Module compiled with module API=20100525, debug=0, thread-safety=0
  PHP    compiled with module API=20060613, debug=0, thread-safety=0
  These options need to match
   in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/mailparse.so' - /usr/php/54/usr/lib64/php/modules/mailparse.so: undefined symbol: zend_new_interned_string in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/oauth.so' - /usr/php/54/usr/lib64/php/modules/oauth.so: undefined symbol: zend_new_interned_string in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/oci8.so' - /usr/php/54/usr/lib64/php/modules/oci8.so: undefined symbol: zend_new_interned_string in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/uploadprogress.so' - /usr/php/54/usr/lib64/php/modules/uploadprogress.so: undefined symbol: zend_ini_string_ex in Unknown on line 0
  
  [15-Dec-2015 03:15:45] PHP Parse error:  syntax error, unexpected T_FUNCTION in /home8/armourer/public_html/produit.php on line 12
  </code></pre>
  
  <p>Is there a solution or am I forced to change provider?</p>