Hi,
I've written a few pages which show a CGridView, allow some filters etc., and have an export button which uses EExcelView (www.yiiframework.com/extension/eexcelview) to output the grid as a file. It works fine on my development machine, but when I put it on the server (in debug mode, just the same as my machine), clicking export gives the following error 'Fatal error: Class 'CException' not found in /var/www/yii/framework/YiiBase.php on line 321'.
Other exceptions get displayed just as normal, and indeed the rest of the site is absolutely fine, so I don't think there can be anything wrong Yii's code. So it must be something in my code or in EExcelView, but they work fine on my computer, and I can't imagine what kind of error could prevent Yii from being able to load CException.
Yii version is 1.1.8 on both machines. PHP is 5.3.2 on my machine, but 5.1.6 on the server. The server is running CentOS and my machine is running Ubuntu.
Any help would be much appreciated.
Page 1 of 1
Fatal error: Class 'CException' not found in ... YiiBase.php
#2
Posted 27 August 2011 - 07:15 AM
This has been solved now.
The actual problem was that the permissions on phpexcel (which EExcelView imports) were set so that Yii couldn't access them. The confusion happened because EExcelView disabled the yii autoloading function while it imported phpexcel (I think to hide an error that comes up when loading phpexcel otherwise). So when the error came up that yii couldn't access phpexcel it couldn't autoload CException so gave that fatal error.
The actual problem was that the permissions on phpexcel (which EExcelView imports) were set so that Yii couldn't access them. The confusion happened because EExcelView disabled the yii autoloading function while it imported phpexcel (I think to hide an error that comes up when loading phpexcel otherwise). So when the error came up that yii couldn't access phpexcel it couldn't autoload CException so gave that fatal error.
#3
Posted 29 February 2012 - 10:33 AM
gandaliter, on 27 August 2011 - 07:15 AM, said:
This has been solved now.
The actual problem was that the permissions on phpexcel (which EExcelView imports) were set so that Yii couldn't access them. The confusion happened because EExcelView disabled the yii autoloading function while it imported phpexcel (I think to hide an error that comes up when loading phpexcel otherwise). So when the error came up that yii couldn't access phpexcel it couldn't autoload CException so gave that fatal error.
The actual problem was that the permissions on phpexcel (which EExcelView imports) were set so that Yii couldn't access them. The confusion happened because EExcelView disabled the yii autoloading function while it imported phpexcel (I think to hide an error that comes up when loading phpexcel otherwise). So when the error came up that yii couldn't access phpexcel it couldn't autoload CException so gave that fatal error.
I have the same problem, but I don't know how to fix it. What was the right fix for you?
Thanks,
#4
Posted 29 March 2012 - 10:21 AM
denisa84, on 29 February 2012 - 10:33 AM, said:
I have the same problem, but I don't know how to fix it. What was the right fix for you?
Thanks,
Thanks,
i ran into the same error, here is how i fix it
in file EExcelView.php
public function init()
{
$this->title = $this->title ? $this->title : Yii::app()->getController()->getPageTitle();
parent::init();
//Autoload fix
spl_autoload_unregister(array('YiiBase','autoload'));
Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);
$this->objPHPExcel = new PHPExcel();
spl_autoload_register(array('YiiBase','autoload'));
error happens in
Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);due to this line, Yii could not find Class 'CException' which comes with autoload
spl_autoload_unregister(array('YiiBase','autoload'));so now, comment out this line first, Yii will throw user-friendly error message, fix the error (in my case, wrong import path for PHPExcel) and come back to remove the comment, voila!
when i ask, if my question does not make sense, don't blame on me, coz i am new here to learn yii;
when i answer, if my answer does not make sense, don't blame on me, coz i am trying to answer to be answered;
ok, i'm covered to mess up and fooling around, yeehaw ...
when i answer, if my answer does not make sense, don't blame on me, coz i am trying to answer to be answered;
ok, i'm covered to mess up and fooling around, yeehaw ...
#5
Posted 29 March 2012 - 10:26 AM
Hi,
Thank you very much. I will give it a try.
Thank you very much. I will give it a try.
rootbear, on 29 March 2012 - 10:21 AM, said:
i ran into the same error, here is how i fix it
in file EExcelView.php
error happens in
due to this line, Yii could not find Class 'CException' which comes with autoload
so now, comment out this line first, Yii will throw user-friendly error message, fix the error (in my case, wrong import path for PHPExcel) and come back to remove the comment, voila!
in file EExcelView.php
public function init()
{
$this->title = $this->title ? $this->title : Yii::app()->getController()->getPageTitle();
parent::init();
//Autoload fix
spl_autoload_unregister(array('YiiBase','autoload'));
Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);
$this->objPHPExcel = new PHPExcel();
spl_autoload_register(array('YiiBase','autoload'));
error happens in
Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);due to this line, Yii could not find Class 'CException' which comes with autoload
spl_autoload_unregister(array('YiiBase','autoload'));so now, comment out this line first, Yii will throw user-friendly error message, fix the error (in my case, wrong import path for PHPExcel) and come back to remove the comment, voila!
Share this topic:
Page 1 of 1

Help













