SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need PEAR on the server for Quickform?

    We will be using an application on a lot of shared webhosts but we can not be certain they will all have PEAR already installed.

    Is it possible to just include some files and take advantage of single PEAR libraries like quickform without anything having to be changed on the server?

    If so how?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,157
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    quickform dependencies

    PEAR packages are code libraries. You will need to ensure that other files the package is dependent on are there or with it. AFAIK most PHP hosts have PEAR installed for their needs, but only the packages they use to run the server. It might be best to bundle all the files you need just to be safe.
    No special compile configuration is needed, but you will have to add the PEAR directory to the include path.

  3. #3
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so for instance, quickform requires the pear common package. So for any file I need to build a form on I would include this .php file along with the quickform .php file correct? I am just making sure that nothing needs to be done on the server, as long we include these files ourselves.

    but you will have to add the PEAR directory to the include path.
    Not sure what you mean here?

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,157
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    dependecies - path

    Typically when I try to install a package and another package that it depends on is missing, it gives a "missing" fail message until I install the needed package.
    For instance, if I went to install HTML_QuickForm but didn't have HTML_Common installed it would fail until I installed HTML_Common first.
    The package download pages list dependecies, but you may want to try a test install directory to make sure.
    The packages use different path formats, sometimes relative to the file but other times relative to the main PEAR folder. For example, PEAR/HTML/QuickForm.php has
    PHP Code:
    require_once('PEAR.php');
    require_once(
    'HTML/Common.php'); 
    and PEAR/HTML/QuickForm/Renderer/Object.php has
    PHP Code:
    require_once('HTML/QuickForm/Renderer.php'); 
    unless you wanted to go through every file and fix the paths, you need to add
    your_install_folder/PEAR/
    to the include_path. It can be done by adding it in the htaccess file, but in your situation you could use ini_set().

  5. #5
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you say "install a package" this makes me think you are installing it to the server from the command line?

    Can we not just upload the .php files to say...
    /public_html/includes/PEAR/

    ?

  6. #6
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my mobile portal
    ghiris.ro

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,157
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)

    installing packages

    I have never had a host that provided command line (yet). With my current host I was able to use go-pear and so I use the GUI to manage packages. On my last host, I couldn't use go-pear, and so I just uploaded packages (after checking for dependencies) making sure the directory structure was correct, and then tested them to make sure they worked OK.
    Off Topic:

    Oddly, with my last host, I was able to add the include path to the htaccess file, but with the current one I have to use ini_set().
    old host : a pain - easy, current host : easy - a pain
    Better than a pain - a pain, but ...
    Why not easy - easy ;(


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •