【问题标题】:require_once not working on MacBook Pro ( Mountain Lion ) but working on all other platformsrequire_once 不能在 MacBook Pro(Mountain Lion)上工作,但可以在所有其他平台上工作
【发布时间】:2012-08-09 19:29:38
【问题描述】:

我遇到了一个奇怪的问题,我在我的 MacBook Pro 上尝试了 MAMP 和 PhP / Apache 的标准安装,但总是得到这个错误

警告: 需要一次(../interfaces/class-ai1ec-get-data-from-cache.php): 无法打开流:中没有这样的文件或目录 /usr/local/zend/apache2/htdocs/wordpress/wp-content/plugins/all-in-one-event-calendar-premium/app/strategies/get_data_from_cache/class-ai1ec-get-data-from-db-cache .php 在第 3 行致命错误:require_once():需要打开失败 '../interfaces/class-ai1ec-get-data-from-cache.php' (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear') 在 /usr/local/zend/apache2/htdocs/wordpress/wp-content/plugins/all-in-one-event-calendar-premium/app/strategies/get_data_from_cache/class-ai1ec-get-data-from-db-cache .php 在第 3 行

来自这个电话

require_once ( '/../interfaces/class-ai1ec-get-data-from-cache.php' );

我是 Mac 新手,所以它一定很愚蠢,但我被阻止了。

当然每个版本我都试过了

require_once ( '../interfaces/class-ai1ec-get-data-from-cache.php' );

require_once ( './../interfaces/class-ai1ec-get-data-from-cache.php' );

【问题讨论】:

  • 我知道这听起来很愚蠢,但是,您尝试请求的文件存在于您尝试请求它们的路径中,对吗?
  • @sabre 当然,在 Windows 上一切正常
  • 好吧,这是排除了一个潜在问题;)。另一种可能是您的 include_path 设置不正确?
  • @sabre 我的想法只是告诉:“上一个目录,然后获取接口/class-ai1ec-get-data-from-cache.php”,也许这是包含的问题,正确现在我的包含路径是 (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear')

标签: php macos apache


【解决方案1】:

这毫无意义:

require_once ( '/../interfaces/class-ai1ec-get-data-from-cache.php' );

您从根目录开始,然后尝试从那里向上一个目录。

尝试输入您的实际完整文件路径,看看是否可行。

【讨论】:

  • 我的意思是返回一个目录。在 Windows 上它可以工作。在 Mac 上,我似乎无法说“返回一个目录”
  • 如果我硬编码 require_once ('/usr/local/zend/apache2/htdocs/wordpress/wp-content/plugins/all-in-one-event-calendar-premium/app/strategies/interfaces /class-ai1ec-get-data-from-cache.php' );一切正常
  • 那么执行这个脚本的代码在哪个目录下?
  • 错误是致命错误:require_once(): Failed opening required '../interfaces/class-ai1ec-get-data-from-cache.php' (include_path='.:/usr/ local/zend/share/ZendFramework/library:/usr/local/zend/share/pear') 在 /usr/local/zend/apache2/htdocs/wordpress/wp-content/plugins/all-in-one-event- calendar-premium/app/strategies/get_data_from_cache/class-ai1ec-get-data-from-db-cache.php 在第 3 行
  • 可能和权限有关
猜你喜欢
  • 2011-01-19
  • 1970-01-01
  • 2014-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-02
  • 2019-06-16
  • 1970-01-01
相关资源
最近更新 更多