PHP PEAR include_path: Accessing packages installed in CPanel

1.9k views Asked by At

I am using GoDaddy for hosting and I've used their CPanel to install a number of PEAR Packages.

I've copied and pasted into the include path modifications code that CPanel recommends in my PHP file. This is the code (where username is replaced with my username):

ini_set("include_path", '/home/username/php:' . ini_get("include_path") );

However, when I run a PEAR Packages check, it will only find the system installed modules and not the packages which I've added.

I have confirmed, through the file manager, that the packages and associated files have been installed into the folders.

Additionally, GoDaddy/CPanel reports that the packages have been successfully installed.

Here is my packages check code:

<?php 
ini_set("include_path", '/home/username/php:' . ini_get("include_path") );

echo ini_get("include_path")."<br>";

require_once 'System.php';
var_dump(class_exists('System', false));
echo "<br>";

include 'PEAR/Registry.php';

$reg = new PEAR_Registry;
foreach ($reg->listPackages() as $package) {
    print "$package<br>";
}
?> 

The resulting output will only show the system installed modules and not my installed PEAR extensions or applications.

Have GoDaddy/CPanel given an incorrect include path?

1

There are 1 answers

0
kguest On

The PEAR_Registry check will only work for PEAR packages which have been installed to the system via the PEAR installer - it won't pick up packages that were simply copied into some directory picked up in the include path.

Code to check for the presence of those packages would need to scan the directories for classes/files that aren't picked up your PEAR_Registry check code and determine which packages they belong to.