The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pear -- At A Loss

Discussion in 'General Discussion' started by mctDarren, Sep 26, 2005.

  1. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    I'm trying to wrap my head around PEAR and I am unsure if what I have is a CPanel or other problem. I have a php script that FTPs some tar files to my server and I wanted to use PEAR to untar them (TAR_Archive). I have the latest PHP 4 version and can easily find PEAR in /usr/local/lib/php. Apache was compiled with PEAR. I downloaded Tar_Archive and placed it within the PEAR directory. But I'm getting errors that it cannot load '/Console/Getopt.php' -- "PHP Warning: main(): SAFE MODE Restriction in effect.". Also, when I try to run any pear command line func's via SSH as root I get: 'Warning: main(Getopt.php): failed to open stream: No such file or directory in System.php on line 23'."

    Is this because I run with safe mode on? Shouldn't it still allow me to run things like upgrade through root? Has anyone gotten around this with PHP scripts? Any (and I mean any) help is appreciated. At the moment I'm running the PHP script via CRON then running another CRON to untar the files, but I would like it all to be straight PHP if possible. TIA
     
  2. ramprage

    ramprage Well-Known Member

    Joined:
    Jul 21, 2002
    Messages:
    667
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    Safe mode disables certain functions in PHP and can limit the actions you can do. Try turning safe mode off for the account.

    'Warning: main(Getopt.php): failed to open stream: No such file or directory in System.php on line 23'."


    Basically means you include path isn't correct.
     
  3. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Yep, the Pear modules should be in the include path by default - check the output of ini_get('include_path') to see what you have, and bear in mind that each Pear module, or family of modules, will sit in it's own directory within the main shared Pear directory and will need to be referenced accordingly.

    You might also want to try installing the Pear module(s) that you need using the command line installer rather than just grabbing the achives and placing them in the Pear directory - pear install <module name>

    By the way, did you uncompress the module archives you downloaded? If you didn't, you won't get much joy!
     
  4. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    Thanks guys for your responses. I think I may have solved the problem.

    @rampage: I hadn't thought of turning it off for just that account. I would rather avoid having it off if possible. I may turn it off momentarily today to see what happens.

    @webignition: Yep, did decompress. Made sure path was set. I even tried moving things around into the main directory and changing the include statement from within the Getopt and System scripts to no avail. Figured it was just safe mode protecting me, but it was very weird. Could be because I had been coding all day and was tired too. :)

    In the end I simply grabbed the scripts I needed, copied them into the main directory of the account, chowned them to the account and included them that way. Works fine now.

    Thanks again for your help. I am still a little concerned about not being able to run perl from command line, but will look at that after my head stops spinning from this project.
     
Loading...

Share This Page