|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pear Structure
I'm pretty new to PEAR. I've got it installed and have been looking through the documentation and other sites. I can't find any info on the way it is organized. I have the main installation in "c:\xamp\php", but there is also a PEAR folder in my htdocs. The files in there look different.
Could someone explain what each folder is used for? Also, I'm trying to get Pear: Pager to work. I've been following this tutorial http : // w w w . alberton.info/pear_pager_tutorial_database_results . h t m l . The php statements require files to make it work, but those files are in the Pear Installation folder. So, since they aren't in my htdocs folder I have to copy them, and I don't know where to copy them to. Each of those php files have others that they require within them, which then means copying more files. When you install a package doesn't it put everything in place for it to work when you reference it? Are you supposed to install pear in htdocs? I am so confused. Thanks! Jason Last edited by jay0316 : November 2nd, 2007 at 02:42 PM. |
|
#2
|
|||
|
|||
|
The include_path is the solution to your confusion. Set the include_path to
'.;c:\xamp\php' (that means: current directory and c:\xamp\php) and require_once calls will work. There is no need to have the PEAR directory under your htdocs directory. |
|
#3
|
|||
|
|||
|
Ok. I checked out my include_path in my php.ini and it had '.;c:\xamp\php\pear' so, I changed it to '.;c:\xamp\php'. Now, according to the tutorial I'm following I have to "require" the Pager_Wrapper.php and MDB2.php. I previously copied those to my htdocs folder because I didn't think I could point to c:\xamp\php\pear\their_directory because this will eventually be on the website. Do you have to copy some of these files to the htdocs folder?
Here is the error I'm getting when I try to do a search using Pager: Fatal error: Call to a member function queryCol() on a non-object in C:\xampp\htdocs\PEAR\Pager_Wrapper.php on line 209 When I open Pager_Wrapper.php it has require statements for other php files. There is no way its going to find them if they are in the pear folder on the c drive. Do I have to change all of those require statements or find all the files and move them into htdocs? I figured that it MUST be easier than what I'm making it. Thanks. Quote:
|
|
#4
|
|||
|
|||
|
Don't edit PEAR files - you would lose your changes on updates. There is also no need to copy them to another location.
Search for PEAR.php on your disk. Next to it, you should also find some subdirectories like PEAR or MDB2 or HTML (the last two depend on your installation, but PEAR will be there). This is the directory that needs to be added to the include_path. My first suggestion was based on the path information that you wrote about. Once this setting points to the right location, all your PEAR packages will find their files and will work then. |
|
#5
|
|||
|
|||
|
Thanks, wiesemann.
I think I'm understanding how this works a little better now. I was thinking that you have to put the require path from the page's location that is in the htdocs folder. So, I was thinking "how am I going to connect to a file that is outside of it." Now, I see that your setting it up so the require path starts from where the include path finishes. Anyways, I think I have all my paths setup right; however, I'm still getting that same error that reads: "Fatal error: Call to a member function queryCol() on a non-object in C:\xampp\php\PEAR\Pager_Wrapper.php on line 209" Is querycol() a built in pear function? I can't figure out why it still can't find this. Any more suggestions? My php.ini file is now set to: ".;C:\xamp\php\pear". From that folder I can see the other PEAR folder as well as the Pager module folder etc. Thanks. Jason Last edited by jay0316 : November 5th, 2007 at 10:02 AM. |
|
#6
|
|||
|
|||
|
queryCol() is a MDB2 function. You should find something like $db->queryCol() in C:\xampp\php\PEAR\Pager_Wrapper.php on line 209 (file and line as written in the error message). The message tells you that $db is not an object (and not a MDB2 instance), likely because something failed. Maybe your database credentials are wrong?
|
|
#7
|
|||
|
|||
|
Here is the line of code it is tripping up on:
$res =& $db->queryCol($query); I think I found the function in MDB2.php if this helps. function queryCol($query, $type = null, $colnum = 0) { $result = $this->query($query, $type); if (!MDB2::isResultCommon($result)) { return $result; } $col = $result->fetchCol($colnum); $result->free(); return $col; } |
|
#8
|
|||
|
|||
|
Ok. I tested my database connection string to make sure it was working correctly and simplified my select statement. I printed out some results below the select statement, which is right before it hits the function giving me all the errors.
The connection string worked and printed out the results, but once it hit the function I got these errors: Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\php\PEAR\Pager_Wrapper.php on line 43 Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\php\PEAR\Pager_Wrapper.php on line 44 Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\php\PEAR\Pager_Wrapper.php on line 45 Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\php\PEAR\Pager_Wrapper.php on line 52 Warning: preg_match() expects parameter 2 to be string, resource given in C:\xampp\php\PEAR\Pager_Wrapper.php on line 57 Fatal error: Call to a member function queryOne() on a non-object in C:\xampp\php\PEAR\Pager_Wrapper.php on line 203 |
|
#9
|
|||
|
|||
|
ever figure this one out?
hey,
I know this a looong time down the line, but did you ever solve this problem? I believe I'm running into the exact some one on a Centos server. I've checked the path and database connection, they're good. -w |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > Pear Structure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|