PHPExcel - Class 'PHPExcel_IOFactory' not found

Topics: Developer Forum, User Forum
Jan 22, 2009 at 12:50 PM
my include path from get_include_path();

File structure looks like this:
alexanderst@dahost:~/public_html$ ls -la /home/alexanderst/public_html/excel/Classes/
total 24
drwxr-xr-x  3 alexanderst alexanderst 4096 2009-01-21 07:50 .
drwxr-xr-x  5 alexanderst alexanderst 4096 2009-01-22 14:01 ..
drwxr-xr-x 10 alexanderst alexanderst 4096 2009-01-21 07:50 PHPExcel
-rw-r--r--  1 alexanderst alexanderst 8846 2009-01-05 20:39 PHPExcel.php

But when loading and trying to read a file (PHPExcel_IOFactory::createReader("Excel2007");) it doesn't find class. I guess I don't include classes the right way?

Fatal error: Class 'PHPExcel_IOFactory' not found in /home/alexanderst/public_html/test.php on line 12
Jan 22, 2009 at 1:09 PM
Looks like your include path is wrong.

Instead of this:

It should look like this:

Then, in your script, do like this:

include 'PHPExcel.php';
include 'PHPExcel/IOFactory.php';

$reader = PHPExcel_IOFactory::createReader('Excel5');
$excel = $reader->load('read.xls');

$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');

Jan 22, 2009 at 1:30 PM
Great thx!

Not really connected to the subject, but how do I open a network file?

$objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objPHPExcel = $objReader->load("//myhost/some_share/afile.xlsx");

Yes I know, PHP running on my linux host and files on windoze :-o Well, that's why I try to create a .xlsx reader so I don't need Office 2007 :-)
Jan 22, 2009 at 1:35 PM
ah, think I get it. Not a part of that domain so I better create a script that copy these files locally and then read them in php.