我要疯了! 我已经在谷歌上搜索了 2 个小时了。
简而言之,事情进展顺利,然后我做了一些班级重组,现在我得到了这个:
Warning: require_once(Zend/Mail/Transport/Sendmail.php) [function.require-once]: failed to open stream: No such file or directory in /nfs/c09/h02/mnt/136160/domains/xyz.com/html/sandbox/Zend/Mail.php on line 1175
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Mail/Transport/Sendmail.php' (include_path='.:/usr/local/php-5.3.13/share/pear') in /nfs/c09/h02/mnt/136160/domains/xyz.com/html/sandbox/Zend/Mail.php on line 1175
我没有触及我的文件是如何组织的:
sandbox/index.php
sandbox/settings.php
sandbox/lib/class1.php
sandbox/lib/class2.php
sandbox/lib/class3.php
sandbox/Zend/...
我只更改了一些类名及其层次结构。
索引.php
<?php
require_once 'lib/class1.php';
$application = new class1();
$application->run();
?>
类1.php
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Log');
Zend_Loader::loadClass('Zend_Log_Formatter_Simple');
Zend_Loader::loadClass('Zend_Log_Writer_Mail');
Zend_Loader::loadClass('Zend_Log_Writer_Stream');
Zend_Loader::loadClass('Zend_Mail');
// class definition ...
?>
在我的班级重组过程中,这些require
都不需要碰。 具体问题(尽管我确定有一个更普遍的问题)发生在 Zend 的邮件中.php:
/**
* Sends this email using the given transport or a previously
* set DefaultTransport or the internal mail function if no
* default transport had been set.
*
* @param Zend_Mail_Transport_Abstract $transport
* @return Zend_Mail Provides fluent interface
*/
public function send($transport = null)
{
if ($transport === null) {
if (! self::$_defaultTransport instanceof Zend_Mail_Transport_Abstract) {
require_once 'Zend/Mail/Transport/Sendmail.php';
$transport = new Zend_Mail_Transport_Sendmail();
} else {
$transport = self::$_defaultTransport;
}
}
...
}
(请注意,仅在第一次尝试发送电子邮件时调用require
。
新的"流"或包含顺序可能会导致此问题吗? (因为路径看起来还可以。 如果路径不好,它会死在装载机.php,不是吗?
某种循环依赖会导致此问题,然后再导致更"致命"的问题吗?
类名可能与已经存在的内容冲突吗? 以前我有一些相当晦涩的类名,比如MalaFwk_Application_Receiver。 现在,名称更加通用,例如CApplication,CComponent,CDatabase,CLogger等。
我已经尝试了其他 SO 线程中建议的各种东西,但无济于事,但我愿意尝试任何人建议的任何事情。 如果这不是一个特别有建设性的问题,我提前道歉,但我没有想法,而且有太多(琐碎但广泛的)更改无法恢复和重新应用这些更改。 任何帮助将不胜感激。 (我将在美国东部标准时间~8:45a回来。
更新:
如果我将以下行添加到索引.php,即"手动"在发生任何其他事情之前需要该文件,那么事情就会再次工作。
require_once 'Zend/Mail/Transport/Sendmail.php';
因此,由于某种原因,当代码到达send()
时,它似乎找不到库。 什么可能导致这种情况?
请将此添加到您的索引中:
set_include_path(implode(PATH_SEPARATOR, array(
realpath('../library'), // Make sure this is the correct path to your library folder
get_include_path(),
)));