SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i can't run pear class correctly

    hi to all.
    I read a thread in this site about my problem. but it was so old(for 64 months ago). By the way. I'm working with pear class to export data from php to excel by Spreadsheet_Excel_Writer-0.9.1. it worked fine at first, but now when i'm going to test that, it doesn't work fine and give me this error :
    Code:
    Fatal error: Class 'PEAR' not found in D:\Program Files\wamp\bin\php\php5.2.5\PEAR\Structures\DataGrid.php on line 447
    i searched a lot about this and have found some ways to solve it. For example most of them say : "you should set include_path..."
    i have setted include_path in php.ini like below:
    Code:
    include_path = ".;c:\php\includes;D:\Program Files\wamp\bin\php\php5.2.5\PEAR\"
    any help would be great.
    thanks

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try replacing your backslashes (\) with forward slashes (/).

  3. #3
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i did, but still it doesn't work fine?!?!

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Try this too: Remove trailing slash after ...\PEAR\

  5. #5
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, I did, but also it gives that error. I think it is not up to setting include_path. There is something else, Because it was working fine with these specifications and after that I installed some other packages and updated pear package, it gives me this error. So what should i do to work it fine?

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    did you stop/restart WAMP between changes?

  7. #7
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Not being 'PEAR' au fair, does the PEAR class actually exist?

    I see you're trying to instantiate an Excel Writer, but your error indicates it cannot create a PEAR object.

    Cups?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  8. #8
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Yeah, is it actually there is a good question.

    How about, what does your page actually understand the include path to be?
    PHP Code:
    <?php
    echo ini_get('include_path') ;
    ?>
    Put that in a page and tell us what it returns.

  9. #9
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did you stop/restart WAMP between changes?
    yes of course.

    Not being 'PEAR' au fair, does the PEAR class actually exist?
    yes it does. I can see its name when I type "pear list" command in cmd.exe windows prompt. Its directories and files are exist too.

    I see you're trying to instantiate an Excel Writer, but your error indicates it cannot create a PEAR object.
    yes it was working fine, but after installing some other pear packages, it doesn' work at all.
    In fact, at first I installed pear and Spreadsheet_Excel_Writer-0.9.1 and OLE packages fine and they worked fine and I getted some output in Excel correctly. there was no problem. just next day when I was going to get another output, it gave me this Error. It is so strange(i'm sorry, my english is not good)

  10. #10
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Yeah, is it actually there is a good question.

    How about, what does your page actually understand the include path to be?
    PHP Code:
    <?php
    echo ini_get('include_path') ;
    ?>
    Put that in a page and tell us what it returns.
    well, it returns :
    Code:
    	
    .;c:/php/includes;D:/Program Files/wamp/bin/php/php5.2.5/PEAR;D:/Program Files/wamp/www//Employee/library/
    I have to set include_path for 2 section.

  11. #11
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Well if its not an include_path issue, its not a pear issue as you as have other pear packages working, then it must be to do with this particular package.

    You could carefully check the dependencies this package has, with a name like that it must depend on a few others.

  12. #12
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)

  13. #13
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing D:/Program Files/wamp/bin/php/php5.2.5/PEAR to D:/Program Files/wamp/bin/php/php5.2.5

  14. #14
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    Try changing D:/Program Files/wamp/bin/php/php5.2.5/PEAR to D:/Program Files/wamp/bin/php/php5.2.5
    Well, I changed include_path but it did not work.

    You could carefully check the dependencies this package has, with a name like that it must depend on a few others.
    Yes this package has some dependencies and I installed all its dependencies. You can see My installed packages as shown in attachment.

    I installed OLE 1.0.0RC1 beta too.
    Attached Images Attached Images

  15. #15
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My problem solved. It was about include_path!!!!!!!!!!!!!!!
    But I'v setted include_path in php.ini with:
    include_path = ".;c:\php\includes".
    In My pages I'v setted the include_path like below:
    set_include_path(get_include_path() . ";". $_SERVER[DOCUMENT_ROOT]."/".$cfg['url_dir'] . ";" . "D:/Program Files/wamp/bin/php/php5.2.5/PEAR");
    It is so strange. when I run "echo get_include_path;" command, It returns:
    .;c:/php/includes;D:/Program Files/wamp/www//Employee/library/;D:/Program Files/wamp/bin/php/php5.2.5/PEAR
    In the other pages the return value of get_include_path command is just like it too. But it did not work until i setted
    set_include_path("D:/Program Files/wamp/bin/php/php5.2.5/PEAR")
    just before operations related to working with the PEAR classes. Now it works fine. But what was the problem? why didn't it work fine?

  16. #16
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Do you maybe have more than one php.ini file on your system?

  17. #17
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Do you maybe have more than one php.ini file on your system?
    Yes I have 2 php.ini file. one of them is in path\wamp\bin\php\php5.2.5 directory and the other one is in path\wamp\bin\apache\apache2.2.6\bin directory. This one is used by apache and when i choose php.ini item in wamp icon on taskbar, this file will open. does That file in php5.2.5 directory has no affect? How can I set that file as php configuration file?
    though, Now I have no problem and it works fine.
    Thank you very much

  18. #18
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Having 2 x php.ini files can lead to madness.

    Pass it on


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
  •