OSx php7.1问题

时间:2017-10-07 07:22:29

标签: php macos symfony macos-sierra spl

我是OSx的新手,我的php安装和SPL功能有问题。有时当我试图通过apache访问symfony项目时,我发现下面有错误。

当spl_autoloader尝试加载ParameterBag类时:

  

警告:class_implements():Class /.[^.]+.twig$/不存在且无法加载

堆栈追踪:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14082/FileSaver.js"></script>

<form role="form">
  <h3>Saving a file with pure JS!</h3>
  <p>Uses HTML5 W3C saveAs() function and the <a href="https://github.com/eligrey/FileSaver.js" target="_blank">FileSaver.js</a> polyfill for this.<br>
  I didn't think this was even possible without a server but the docs say it should work in IE 10+,  Sweet!</p>
  <div class="form-group">
    <label for="input-fileName">File name</label>
    <input type="text" class="form-control" id="input-fileName" value="textFile" placeholder="Enter file name">
  </div>
  <div class="form-group">
    <label for="textarea">Text</label>
    <textarea id="textarea" class="form-control" rows="10" placeholder="Enter text to save">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae iure ab voluptate sunt reiciendis, officia, aliquam temporibus. Quo laudantium quaerat ad, deleniti optio ex, dignissimos, ea accusamus placeat tempora minima!</textarea>
  </div>
  <button id="btn-save" type="submit" class="btn btn-primary">Save to file</button>
</form>

其他奇怪的错误:

  

DebugClassLoader.php第243行中的OutOfMemoryException:

     

错误:允许的内存大小为1073741824字节耗尽(尝试分配140495632205216字节)

我调试了此错误,发现在这种情况下自动加载器尝试加载格式错误的界面: enter image description here

我已经从brew安装了httpd和PHP 7.1。

我的php模块:

1 in DebugClassLoader.php line 243
2 at ErrorHandler->handleError('2', 'class_implements(): Class /\.[^.]+\.twig$/ does not exist and could not be loaded', '/Users/mtertishniy/sites/dvsota/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php', '243', array('class' => 'Symfony\Component\HttpFoundation\ParameterBag', 'file' => '/Users/mtertishniy/sites/dvsota/vendor/composer/../symfony/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php', 'exists' => true, 'refl' => object(ReflectionClass), 'name' => 'Symfony\Component\HttpFoundation\ParameterBag', 'notice' => array(), 'len' => '8', 'ns' => 'Symfony\', 'parent' => false, 'parentInterfaces' => array('/\.[^.]+\.twig$/' => '1'), 'deprecatedInterfaces' => array(), 'interface' => '/\.[^.]+\.twig$/'))
3 at class_implements('/\.[^.]+\.twig$/') in DebugClassLoader.php line 243
4 at DebugClassLoader->loadClass('Symfony\Component\HttpFoundation\ParameterBag')
5 at spl_autoload_call('Symfony\Component\HttpFoundation\ParameterBag') in Request.php line 247

如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

因为你的限制非常大。

您正在尝试分配140495GB的数据。

您需要:

  • 重新考虑您的申请需要多少ram(推荐)
  • 将内存限制增加到140495GB(不推荐)。

尝试分配128MB ro 256MB数据。

答案 1 :(得分:0)

我终于想通了!这是核心php中的错误&lt; 7.2。 https://bugs.php.net/bug.php?id=74015

问题已经结束。