开发者

how to use a pear package?

开发者 https://www.devze.com 2022-12-23 02:10 出处:网络
I want to use HTTP_DOWNLOAD to manage my downloads ,, I have never used PEAR before !! HTTP_DOWNLOAD depends on many other packages , I downloaded them and the ones they , in turn , depend on and thi

I want to use HTTP_DOWNLOAD to manage my downloads ,, I have never used PEAR before !!

HTTP_DOWNLOAD depends on many other packages , I downloaded them and the ones they , in turn , depend on and this is the structure I made :

Download.PHP    <---HTTP_DOWNLOAD MAIN FILE
Header.php      <--- HTTP_HEADER MAIN FILE
PEAR.php
PEAR5.php         
Type.php        <--- MIME_Type
   >Type        <---- FOLDER
      - Extension.php    MIME_Type File
      - Parameter.php    MIME_Type File

assuming that Http_DOWNLOAD depends on :

* PHP 4.2.0
* PEAR 1.4.0b1
* PEAR
* HTTP_Header
* pcre extension
* Archive_Tar (Optional)
* Archive_Zip (Optional)
* MIME_Type (Optional)
* mime_magic extension (Optional)
* pgsql extension (Optional)

and I edited the paths inside each file to reflect this structure , and I tried to run t开发者_C百科he following code :

<?php
require_once 'Download.php';
$params = array('file'=>'file.zip');
$down = new HTTP_Download($params);
$down->send(true); 
?>

nothing happens !! I also got a hard time trying to figure how to use the class and I think this code should work .. but not sure !

Help Please !


if you can, use the pear installer. that will take care of downloading the interdependencies and will ensure they all get placed into the appropriate directories. Also ensure your include_path is set correctly.

if pear is installed properly, you should be able to do something like: $pear list and get a list of all packages that are installed locally.

http://pear.php.net/manual/en/installation.php should help

You will need to do something akin to:

$ sudo pear install HTTP_Download
[sudo] password for kguest:
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update
WARNING: "pear/Archive_Zip" is deprecated in favor of "pecl/zip"
Did not download optional dependencies: pear/Archive_Zip, use --alldeps to download automatically
pear/HTTP_Download can optionally use package "pear/Archive_Zip"
downloading HTTP_Download-1.1.3.tgz ...
Starting to download HTTP_Download-1.1.3.tgz (12,054 bytes)
.....done: 12,054 bytes
downloading HTTP_Header-1.2.0.tgz ...
Starting to download HTTP_Header-1.2.0.tgz (10,440 bytes)
...done: 10,440 bytes
install ok: channel://pear.php.net/HTTP_Header-1.2.0
install ok: channel://pear.php.net/HTTP_Download-1.1.3


Change the require_once function so that it prepends the path to your PHP folder. Like:

require_once '/home/[youraccount]/php/Download.php';

0

精彩评论

暂无评论...
验证码 换一张
取 消