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.
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.