PEAR Packages

Status
Not open for further replies.

openforum

New Member
Messages
6
Reaction score
0
Points
0
Hi, just wondering how would I go about installing the following two PEAR packages:

PEAR::Spreadsheet_Excel_Writer

and

PEAR::OLE


Thanks
Dave
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
You can install PEAR in your account for yourself only. I've done it before and you can manage yourself the packages you want. I'll go get more info and post back.

On the PEAR website ( http://pear.php.net/manual/en/installation.shared.php#installation.shared.ftp ) you have two options. The new way or the old way. The new way works by syncing a pear installation on your computer with a pear installation on your hosting account. The old way ( the way I used) simply creates a PEAR installation on your hosting account and manages it from the web. You can choose either, and it will enable you to install your own pear packages.
 
Last edited:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I believe the CLI version of php is the same as the web one. I used the regular php path without problem.
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
/usr/local/bin/php == `which php`

PHP 5.2.10 (cli) (built: Jul 15 2009 21:06:27)

On Chopin.
This should be the same on each server then.
 
Last edited:

openforum

New Member
Messages
6
Reaction score
0
Points
0
Thanks for all the helpful responses. I just went ahead with the install and it was fine.

I have installed the PEAR files in the upper most level, in the same directory level as:

public_html

in the folder PEAR.

Upon completing the installation, the files are stored in:

PEAR/PEAR/

Installation tells me to use the following include path for PHP files:

PEAR Installation path (/home/openforum/PEAR/PEAR)

I have since installed the PEAR package: Spreadsheet_Excel_Writer

and have included this in the include path:

/home/openforum/PEAR/PEAR/Spreadsheet/Excel/Writer.php

When I execute the script, I get the following error:

Warning: include(/home/openforum/PEAR/PEAR/Spreadsheet/Excel/Writer.php) [function.include]: failed to open stream: No such file or directory

I have placed the script file in the public_html folder.

What am I doing wrong?



Thanks for the help!
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
you need to add the following to every file requiring the PEAR packages
PHP:
set_include_path('/home/openconf/PEAR/PEAR' . PATH_SEPARATOR . include_path());
Afterward, you simply include like this:
PHP:
include('Spreadsheet/Excel/Writer.php');

If you still get an error, check to see if the path is correct.
 
Last edited:

openforum

New Member
Messages
6
Reaction score
0
Points
0
you need to add the following to every file requiring the PEAR packages
PHP:
set_include_path('/home/openconf/PEAR/PEAR' . PATH_SEPARATOR . include_path());
Afterward, you simply include like this:
PHP:
include('Spreadsheet/Excel/Writer.php');
If you still get an error, check to see if the path is correct.

Thanks, I did what was suggested above and got the following error:

Fatal error: Call to undefined function include_path()

This is what is in my script:

<?php
//Set PEAR Directory
set_include_path('/home/openforum/PEAR/PEAR' . PATH_SEPARATOR . include_path());

// include class file
include('Spreadsheet/Excel/Writer.php');

// initialize reader object
$excel = new Spreadsheet_Excel_Writer();

// send client headers
$excel->send('Abstracts.xls');


Hope my syntax is correct.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Fatal error: Call to undefined function include_path()




PHP:
//Set PEAR Directory
set_include_path('/home/openforum/PEAR/PEAR' . PATH_SEPARATOR . include_path());

It should be get_include_path(), so

PHP:
//Set PEAR Directory
set_include_path('/home/openforum/PEAR/PEAR' . PATH_SEPARATOR . get_include_path());
 
Last edited:

openforum

New Member
Messages
6
Reaction score
0
Points
0
OMG...the script works!

Thank you xav0989 and descalzo for the awesome help! Now I can show my lecturer my web development to complete my thesis!


Thank you all!
 
Status
Not open for further replies.
Top