Pear Include Path
Pear packages may add a distinct functionality to a website in a fraction of the time. If you decide to use a pear package, you can simply install the package with PEAR in Cpanel. Cpanel allows you to see many packages and install, uninstall packages. You simple click on `Pear Packages`and follow the simple instructions. Cpanel may tell you where the files are within the home directory for the particular user account. For the keen individual, you can find PEAR at the unix command prompt:
# pear config-get php_dir
Now, that PEAR is installled, you need to use those files in your php code. Depending on the user account, the files will be installed ina particular directory. For example, the new `Calendar`package may be installed in /home/johndoe/php/Calendar/ directory.
There are a couple of options for which to use these files; set an include path within php.ini or hard code the include path within the file.
To see the where php.ini is, type the following unix command:
# php –ini
Now, make a simple php file and set an include, or just remember where it is.
include_path = “/usr/lib/php”;
Now that you know where the include path is located, you can create a test php file. The test file will use the require_once function to get the pear package. What you can do is point the include path in the path of the installed pear files. Then, check to see how it worked. You may find that they should be in your include path like /usr/lib/php because many classes and includes will automatically point to the set include directory on the server. You can move all files into your include path or hard code the files of the package where they had been installed. If they go into the include directory, they are resusable. If the paths are hardcoded, it will be more time consuming to make the changes, but you could do it with a cpanel shared account.
In a nutshell, the simplest method is to find the installed PEAR package files and move them into the includes folder that is set in php.ini. Then, use the path in your require_once function.