Exception 尝试抛出异常会导致php cli出现致命错误

Exception 尝试抛出异常会导致php cli出现致命错误,exception,php-5.3,php,Exception,Php 5.3,Php,我试图在为PHPCLI编写的脚本中抛出新的异常(…) 这就是错误: PHP Fatal error: require(): Failed opening required '/Exception.php' (include_path='.:/usr/share/php:/usr/share/pear') in /file.php 这是指: if (!file_exists($path)) { if (!mkdir($path)) { throw new Excepti

我试图在为PHPCLI编写的脚本中
抛出新的异常(…)

这就是错误:

PHP Fatal error:  require(): Failed opening required '/Exception.php'
(include_path='.:/usr/share/php:/usr/share/pear') in /file.php
这是指:

if (!file_exists($path)) {
    if (!mkdir($path)) {
        throw new Exception('Unable to create directory: ' . $path);
    }
}
这是配置问题还是其他原因造成的

我以前没有写过任何与PHPCLI一起使用的东西,所以在很多类似的事情上我都不确定


感谢所有帮助。

此错误与php cli无关。此外,它与例外情况无关

您收到的消息错误是由于您的代码中有如下语句:

<?php

require '/Exception.php';

我的代码中没有这个。尽管你为我指明了正确的方向。我使用的代码来自github存储库,其中包括SPLClassLoader,它似乎是类和名称空间的自动加载程序。现在需要想办法解决这个问题。@Nalum我对drupal自动装弹机也有同样的问题。您最终找到了解决方案吗?@Shawn我无法在帮助脚本的时间范围内找到解决方案,因此采用了不同的方法(不使用CLI)。对不起,我帮不了你。