2

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 the 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 !

2 Answers 2

2

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
-1

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

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

5
  • In fact you might want to do: " ini_set('include_path', '/path/to/your/php/'); require_once 'Download.php'; ". Of course changing /path/to/your/php/ to the actual path where your PHP folder is.
    – JonnyLitt
    Commented Mar 14, 2010 at 23:23
  • NOTHING Happened !!! :( I added it but still no result ... I don't know the mistake is on the structure or in my code Commented Mar 14, 2010 at 23:37
  • If the files downloaded correctly, then it is most likely not at Pear's end. Try throwing a file in the PHP folder with contents you know will work, like echoing something. Then try to include that file you made. If that fails, then you most likely are not including in the right directory. Also, do you have error logging on? If so what is it saying?
    – JonnyLitt
    Commented Mar 14, 2010 at 23:41
  • I tried to include a file with a variable and echo 'ed it successfully, NO , i don't know how to turn errors on . it may need more files from pear ? not only PEAR.php and PEAR5.php !? Commented Mar 15, 2010 at 0:08
  • You should try reinstalling Pear with all the files it includes. Then try again, otherwise if that doesn't work, then the package you downloaded may be incomplete or may need more references. Try also downloading every package it needs with pear too.
    – JonnyLitt
    Commented Mar 15, 2010 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.