I am attempting to use require to load the ExcelPHP API to manipulate CSV spreadsheets. I am using EasyPHP 12.1 with PHP 5.4.6, Apache 2.4.2, MySQL 5.5.27 and Xdebug 2.2.1. I am on Windows 7.
When I attempt to run the following code:
require_once('classes/PHPexcel/Autoloader.php');
$mySheet = new PHPExcel();
I get a fatal error:
Notice: Use of undefined constant PHPEXCEL_ROOT – assumed ‘PHPEXCEL_ROOT’ in C:\Program Files\EasyPHP-12.0\www\Classes\Classes\PHPExcel\Autoloader.php on line 73
Fatal error: Class ‘PHPExcel_Shared_ZipStreamWrapper’ not found in C:\Program Files\EasyPHP-12.0\www\Classes\Classes\PHPExcel\Autoloader.php on line 31
I have tried commenting out line 31 in the Autoloader.php file, and that prevents the the fatal error but then the API won’t work and PHP doesn’t recognize the PHPExcel class.
Can someone please help me figure out how to get my library to work? Thanks in advance!
Load the PHPExcel class in your require once, rather than the Autoloader (as Seth) has said. Case-sensitivity is also a potential problem, because your scripts won’t transfer without error unless you get it right:
should be
and the library is PHPExcel, not ExcelPHP as you call it in your subject line