muhsin_ap
muhsin_ap

Reputation: 62

Fatal error: Class 'PHPExcel_Shared_String' not found

I have used PHPExcel for my codeigniter app and it is working perfectly in localhost, but when I host this to server, I am getting following error :

Fatal error: Class 'PHPExcel_Shared_String' not found in \xx\xx\xx third_party\PHPExcel\Autoloader.php on line 36

Upvotes: 2

Views: 14989

Answers (5)

geekinit
geekinit

Reputation: 1355

What worked for me was changing PHPExcel/Autoloader.php line 81 from

if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) {

to

if ((stream_resolve_include_path($pClassFilePath) === FALSE)) {

I prefer this approach because it didn't require me to modify file permissions and it should work in PHP 5.3.2 and later.

Upvotes: 0

Rob
Rob

Reputation: 127

If your server is on Linux, it can be permission problem... Just add all permissions for PHPExcel Folder in you Vendor (on server side) and all subfolders for it. I have same problem and i have solved it by this way...

Upvotes: 0

JoseSilva
JoseSilva

Reputation: 517

I had this issue too and i solved it by changing permissions on "Shared" directory to 655.

I Hope it helps

Upvotes: 0

Edward Mungai
Edward Mungai

Reputation: 21

struggled with this issue for a long time under Linux and PHP 5.4x. In the end, in addition to the fix above, I resorted to changing the code on line 73 of the Autoloader file which sets the $pClassFilePath variable from relative (using PHPEXCEL_ROOT) to absolute following the machines file tree. This might only be a hack, but it saved my sanity after several days of trying. Hope this helps someone. Cheers

Upvotes: 1

Mark Baker
Mark Baker

Reputation: 212412

There was a change introduced to the autoloader in the latest version of PHPExcel that appears to have broken backward compatibility with versions of PHP < 5.3.0

If you edit the Classes/PHPExcel/Autoloader.php file and change line 58, which should read

return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'), true, true);

to

return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));

I've already made a change to the develop branch on github to test for the PHP version and execute the appropriate line

While this was not deliberate, please note that we really are trying to get users to upgrade to at least version 5.3.0 of PHP, because we can't address any of the memory/performance issues that users working with large spreadsheets complain about until we can use some of the new features available in more recent versions of PHP. Version 5.2 of PHP is no longer supported, and even version 5.3 is end-of-life and will be unsupported before the end of this year

Upvotes: 3

Related Questions