tags:

views:

142

answers:

3

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 !

A: 

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

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

JonnyLitt
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
NOTHING Happened !!! :( I added it but still no result ...I don't know the mistake is on the structure or in my code
Naughty.Coder
how to test if pear is installed correctly>
Naughty.Coder
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
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 !?
Naughty.Coder
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
thanks Jonny , i'll try that
Naughty.Coder
+1  A: 

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
kguest
A: 

I thought I would like to ask anyone advise regarding pears File_Archive.

One question: I am looking for a way to implement a form that uploads a zip file, and possibly (if possible using cache) auto unzips the files to a directory on the server, does anyone know where I can see an example of such an implementation in php using pears "File_Archive?

One last has anyone seen any pear classes that can upload image files but ALSO does sanity checks on the files, for example detecting against images files that has code in it, the type of code that can compromise a server?

But the question about File_Archive is most important.

mark
Why are you answering a question with a question? Ask your own question!
Billy ONeal