Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Web Hosting Services

Notices

Reply
 
Thread Tools
  #1  
Old 12-16-2006, 10:53 AM
bewhite bewhite is offline
Hatchling Croc
 
Join Date: Dec 2006
Posts: 16
Default PHP -> PEAR -> Excel_Spreadsheet_Writer

Hello!

I am a PHP developer. I have to use Excel_Spreadsheet_Writer module in my website. I have working copy of the website on my local computer, but when I'm trying to upload it on hosting I see next error:

Fatal error
: Class 'Spreadsheet_Excel_Writer' not found in /home/...

As I understand, I need to include line like "require_once "path_to_the_Writer.php"" in my PHP script. Can anyone from support tell me this path? Can any other developer tell me it?

Thanks.
Reply With Quote
  #2  
Old 12-16-2006, 02:25 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

If you are using "require_once" and it is failing, your path is wrong.

The path works the say way as it works for images. (provided that the script is below /public_html/
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
  #3  
Old 12-16-2006, 03:02 PM
bewhite bewhite is offline
Hatchling Croc
 
Join Date: Dec 2006
Posts: 16
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by Serra View Post
If you are using "require_once" and it is failing, your path is wrong.
Yes, the path is wrong. The question is what is the correct path?

Quote:
Originally Posted by Serra View Post
The path works the say way as it works for images. (provided that the script is below /public_html/
In my opinion, it is not related with the public_html folder. This module (Excel_Spreadsheet_Writer) is common for all hosting accounts on my server and installed somewhere in the PHP folder (c:\php\ by default).

Does anybody know this path?
Reply With Quote
  #4  
Old 12-16-2006, 05:59 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Sorry, I misunderstood. I thought you were asking who to include PHP into PHP. If you want to include Perl modules into PHP, its fairly simple. You can't.
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
  #5  
Old 12-16-2006, 11:19 PM
bewhite bewhite is offline
Hatchling Croc
 
Join Date: Dec 2006
Posts: 16
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by Serra View Post
Sorry, I misunderstood. I thought you were asking who to include PHP into PHP. If you want to include Perl modules into PHP, its fairly simple. You can't.

I don't need the Perl. Excel_Spreadsheet_Writer is the PHP module. I just need to know path to it on the server. I need to use this path in the "require_once" .
Reply With Quote
  #6  
Old 12-17-2006, 08:44 AM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Post exactly the require once line you used.
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
  #7  
Old 12-17-2006, 11:10 AM
bewhite bewhite is offline
Hatchling Croc
 
Join Date: Dec 2006
Posts: 16
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by Serra View Post
Post exactly the require once line you used.
I have found correct path to the module. Finally, working line is:
require_once "Spreadsheet/Excel/Writer.php";

Thank you for your help.
Reply With Quote
  #8  
Old 12-17-2006, 11:38 AM
chaloupe chaloupe is offline
King Croc
 
Join Date: Nov 2004
Location: Dieppe, New-Brunswick, Canada
Posts: 1,427
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Their is a good tutorial here:
http://pear.php.net/manual/en/packag...iter.intro.php

require_once 'Spreadsheet/Excel/Writer.php';

Best Regards,

__________________
Jean Boudreau - IT for local businesses
It's all about automation!
Any data backup of your company?

Reply With Quote
  #9  
Old 12-17-2006, 02:53 PM
bewhite bewhite is offline
Hatchling Croc
 
Join Date: Dec 2006
Posts: 16
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by chaloupe View Post
Their is a good tutorial here:
http://pear.php.net/manual/en/packag...iter.intro.php

require_once 'Spreadsheet/Excel/Writer.php';

Best Regards,

I have already found this information. I have wrote about it in my previous post. In all cases thanks for your help.
Reply With Quote
  #10  
Old 12-17-2006, 07:17 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Wow, that is cool!
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
  #11  
Old 12-17-2006, 09:58 PM
tomowa tomowa is offline
Junior Croc
 
Join Date: Aug 2005
Location: Odessa, Wa
Posts: 135
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

I want to have an online spreadsheet, and don't really want to use Googles online spreadsheet setup.
Is that what this is all about doing? I looked at the link chaloupe posted it it doesn't explain (to me at least), what the concept of this spreadsheet writer is all about

Thanks, Tom
Reply With Quote
  #12  
Old 12-18-2006, 07:56 AM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Ok, some stuff to remember when trying to use this.

1. php.ini override files change your include settings. They must be
include_path = ".:/usr/lib/php:/usr/local/lib/php"

The PEAR stuff is in the third path listed.

2. PEAR might be installed, items might be listed in CPANEL, but they may not be installed.

Use pear list to see what is installed.

In my case, OLE nor Spreadsheets were actually installed. In fact, it looks like almost nothing was installed. I installed OLE and Spreadsheets and it works fine now using the example code above.

Basically, this is a PHP module that allows programmers to write to xls files directly from PHP. If you upload the example in a php file, it will create a spreadsheet with the variables listed.

I wrote a quick program that dumps a file into a spreadsheet from a database.
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included

Last edited by Serra; 12-18-2006 at 08:44 AM.
Reply With Quote
  #13  
Old 12-18-2006, 01:41 PM
tomowa tomowa is offline
Junior Croc
 
Join Date: Aug 2005
Location: Odessa, Wa
Posts: 135
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Yea, that is cool The code I copied from chaloupes link results in this www.tomowa.net/php_excel
Code:
 
 
<?php
require_once 'Spreadsheet/Excel/Writer.php';
 
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
 
// sending HTTP headers
$workbook->send('test.xls');
 
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('My first worksheet');
 
// The actual data
$worksheet->write(0, 0, 'Name');
$worksheet->write(0, 1, 'Age');
$worksheet->write(1, 0, 'John Smith');
$worksheet->write(1, 1, 30);
$worksheet->write(2, 0, 'Johann Schmidt');
$worksheet->write(2, 1, 31);
$worksheet->write(3, 0, 'Juan Herrera');
$worksheet->write(3, 1, 32);
 
// Let's send the file
$workbook->close();
?>
What I want to do is take info as shown in my spreadsheet here http://spreadsheets.google.com/pub?k...TmEx_eXy3Z3xIw, (it's a log I keep data on irrigation wells for my employer), and be able to enter it from a web interface, ie enter the date, select the well, then enter the 3 pieces of data for each well. Then have it displayed in a webpage, to fit on one page for printing out simply.

What is the best way to do this? MySQL and PHP? If anybody knows of any tutorials that would get me going in the right direction, it would be appreciated

Tom
Reply With Quote
  #14  
Old 12-18-2006, 05:42 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by tomowa View Post
What is the best way to do this? MySQL and PHP? If anybody knows of any tutorials that would get me going in the right direction, it would be appreciated
Yea, this is NOT a good application of this software. What you want to do is a serious amount of work and not for the feint of heart. The way you are doing it is far better than programming a mysql interface.

The best use of this software is to take a mySQL database and export it as an excel. For that, it works wonderfully. I really had never done anything with PEAR before. Of course, it would have never worked because I didn't have any of it installed on my server, but now that I know how to install it, I may well use it more often.
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
  #15  
Old 12-18-2006, 11:07 PM
tomowa tomowa is offline
Junior Croc
 
Join Date: Aug 2005
Location: Odessa, Wa
Posts: 135
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
What you want to do is a serious amount of work and not for the feint of heart.
Thanks for the warning Serra I'm gonna shelve it then....I can't even find time to get to my exercise bike, which I actually enjoy , let alone tackle learning this
Reply With Quote
  #16  
Old 03-04-2008, 02:08 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: PHP -> PEAR -> Excel_Spreadsheet_Writer

Quote:
Originally Posted by tomowa View Post
Thanks for the warning Serra I'm gonna shelve it then....I can't even find time to get to my exercise bike, which I actually enjoy , let alone tackle learning this
If you are having problems installing this, the correct commands would be:

pear install OLE-beta
pear install Spreadsheet_Excel_Writer-beta
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 10:13 PM.