Closed GerhardLiebenberg closed 10 years ago
Do you have that file?
Include should not be affected by autoload.
Yes, I have the Zend/Validate/Hostname/Com.php file. I have the whole zend library included in Yii bootstrap.
Try adjusting your PHP include path. It doesn't seem to be related with autoloading at all.
I have this: Yii::setPathOfAlias('common', $root . DIRECTORY_SEPARATOR . 'common'); Yii::setPathOfAlias('Zend', $root . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Zend');
This works: include('common/lib/Zend/Validate/Hostname/Com.php');
This throws the error: include('Zend/Validate/Hostname/Com.php');
Yeah, that's include path of your PHP. You need to do set_include_path('zend/library/dir'.get_include_path())
.
Thank you Alexander
I had to do set_include_path('common/lib;' . get_include_path()) in the code - (note the semicolon after common/lib;) OR I could add 'common.lib.*' to the 'import' array in config/main.php
I thought the problem was the last part of the path, but it was the first part of the path.
Hi
I'm trying to test zend email in a Yii "console" script.
The console command calls a behavior in common/extensions/behaviors/....
The behavior function has this code: Yii::import('common.extensions.EZendAutoloader', true); EZendAutoloader::$prefixes = array('Zend'); EZendAutoloader::$basePath = Yii::getPathOfAlias('common.lib') . DIRECTORY_SEPARATOR; Yii::registerAutoloader(array("EZendAutoloader", "loadClass"), true);
This code works fine: $tr = new Zend_Mail_Transport_Sendmail('-freturn_to_me@example.com'); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail(); $mail->setBodyText('This is the text of the mail.'); $mail->setFrom('somebody@example.com', 'Some Sender'); $mail->addTo('somebody_else@example.com', 'Some Recipient'); $mail->setSubject('TestSubject'); $mail->send();
But if I change the first row to: $tr = new Zend_Mail_Transport_Smtp('mail.example.com');
Then this error follows: include(Zend/Validate/Hostname/Com.php): failed to open stream: No such file or directory (C:\xampp\htdocs\iccap\common\lib\Zend\Validate\Hostname.php:586)
Line 586 of Hostname.php is: $regexChars += include($this->_validIdns[strtoupper($this->_tld)]);
So it looks like this 'include' is not working. Any ideas?