| View previous topic :: View next topic |
| Author |
Message |
Mattallyc
Joined: 16 Sep 2008 Posts: 3 Location: Cornwall - UK
|
Posted: Tue Sep 16, 2008 12:35 pm Post subject: First time PEAR user, trouble with Spreadsheet_Excel_Writer |
|
|
Hi All,
I've had PHP5 running for a long time on a win 2K3 server (IIS6) and very recently enabled PEAR so that I could use the Spreadsheet_Excel_Writer class.
I believe PEAR is working correctly but when I try to run the sample code at:
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.intro.php
I get:
[16-Sep-2008 10:55:41] PHP Fatal error: Class 'Spreadsheet_Excel_Writer' not found in C:\Inetpub\wwwroot\Database\PEAR.php on line 6
line 6 is:
$workbook = new Spreadsheet_Excel_Writer();
which comes from line 3:
require_once 'Spreadsheet/Excel/Writer.php';
I've checked that Writer.php is in the Spreadsheet/Excel folder and it is. The full path is:
C:\PHP\PEAR\Spreadsheet\Excel
Anyone got any suggestions as to why this isn't working?
Cheers,
Matt |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Tue Sep 16, 2008 8:31 pm Post subject: |
|
|
| "C:\PHP\PEAR\" needs to be added to the include_path setting, otherwise the files cannot be found. |
|
| Back to top |
|
 |
Mattallyc
Joined: 16 Sep 2008 Posts: 3 Location: Cornwall - UK
|
Posted: Wed Sep 17, 2008 9:54 am Post subject: |
|
|
Thanks for the reply,
I've already got:
;***** Added by go-pear
include_path=".;C:\PHP\pear"
;*****
in my php.ini file.
Just to check that it can find the file I changed line 3 to:
require_once 'Spreadsheet/Excel/Writer2.php';
and got a different error message:
Failed opening required 'Spreadsheet/Excel/Writer2.php'
So I assume it can see the file, it just can't find the class within it.
I've checked Writer.php for the class and on line 45 there is:
class Spreadsheet_Excel_Writer extends Spreadsheet_Excel_Writer_Workbook
so the class is there.
What's missing?
Can I do a basic check to see if pear is working properly?
Thanks for any help,
Matt. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Wed Sep 17, 2008 1:00 pm Post subject: |
|
|
| Sorry, yes, you're right, the file can indeed be found, but not the class. Would it be possible that you have named your own files PEAR.php or Writer.php? It's weird that the message claims that the class cannot be found in PEAR.php. (Because there is indeed no such class in that file, at least not in the official version of it.) |
|
| Back to top |
|
 |
Mattallyc
Joined: 16 Sep 2008 Posts: 3 Location: Cornwall - UK
|
Posted: Wed Sep 17, 2008 1:20 pm Post subject: |
|
|
Thankyou Thankyou Thankyou!!!
For some reason I named the page pear.php (couldn't think of anything more imaginative) and naturally this screwed it all up.
I renamed it test.php and bingo! It worked.
Now I suppose I've got to knuckle down and start banging out some spreadsheets...
Thanks ever so much for your help.
Regards,
Matt. |
|
| Back to top |
|
 |
|