As a standardized and powerful arsenal in PHP, PEAR has always attracted much attention, but it has not been taken seriously in the practical field. The reasons include incomplete documentation, insufficient learning materials, a complicated code system, and insufficient developer support.
But sooner or later this arsenal will be given enough attention. If you can start learning now, you may be able to gain a certain advantage.
There is a support issue with PEAR usage. Many servers may use disable pear when compiling, so PEAR is not supported. Because its installation requires permission to modify php.ini, users may feel powerless for unsupported hosts.
There is another situation where the host server provides PEAR, and you can see the PEAR inclusion in phpinfo. However, since the host is running in safe mode, since the owner of PEAR is not you, you still not available.
Here is a method that you can install PEAR yourself on your shared hosting.
According to the requirements of the PEAR document, your PHP can be used with version 4.04 or above, but some modules require version 4.05 or above, which actually means that the minimum requirement is still version 4.05. Of course, this is not a problem, because if your host is still on 4.06, you should consider changing the host.
Things to consider when choosing poems for PEAR’s own version. You may notice that PEAR is included in all PHP source packages, but in fact PEAR in the latest PRE version is not complete at all. So my suggestion is to download the 4.23 release package, unzip it and upload all the contents of the pear directory to your home directory, and keep the directory name as pear.
If you are patient enough, you can download the latest version 4.30pre2, and then use the diff tool to compare (I mean Windows users), and directly replace the old files with the new changed files.
If you take the trouble, you can go to the pear directory in http://cvs.php.net to download the latest version of each file.
Use PEAR:
Add
ini_set("include_path", "/absolute/path/to/pear");
in the head of your program;
In this way, you will directly change include_path to your pear Table of contents.
One disadvantage of the above settings is that if you have other include directories, they will be cancelled. So you need to consider other existing include paths.
In the user comments in the PHP manual, someone suggested using:
ini_set("include_path",ini_get("include_path").": /path/to/pear");
This way.
I'm not sure this might work for you.
But at least my server doesn’t support it, so there will be problems.
For me I can only use:
$oldpath = ini_get("include_path");
ini_set("include_path","/path/to/pear:".$oldpath);
Look carefully The difference between the two is whether the pear path is placed at the beginning or at the end. (The colon is the path delimiter).
I think you may need to test both cases to see which one works.