On domestic rented virtual hosts, some hosts themselves provide the pear class library, but there is no need to expect them to upgrade or install the required pear packages for you. In this case, you can try to install it under your own virtual host. A copy of pear.
Install pear via ssh
Most domestic virtual hosts do not provide ssh, but if it is a friend's server, they may be more relaxed and give you permissions. Let's take a look at the steps to install pear on the virtual host through ssh:
PEAR 1.3.5 or below:
$ pear -s -c ~/.pearrc -d doc_dir=~/pear/docs
-d ext_dir=~/pear/ext -d php_dir=~/pear/lib
-d data_dir=~/pear/data -d test_dir=~/pear/tests
-d cache_dir=~/pear/cache -d bin_dir=~/pear/bin
PEAR 1.4 or above:
$ pear config-create /home/user/pear .pearrc
This creates a .pearrc file under the user's home
and adds it to the .bashrc file
PEAR 1.3.2 or below:
$ pear -c ~/.pearrc install Archive_Tar PEAR Console_Getopt XML_RPC
PEAR 1.3.3 or above
$ pear install -o PEAR
thus creates a new pear directory in the user's home directory. This pear is a complete copy of the pear on the host.
In order to use the pear package just installed, you need to specify it in the php code include_path
PLAIN TEXT
PHP:
<?php
ini_set('include_path','~/pear/lib'. PATH_SEPARATOR
.ini_get('include_path'));
// From PHP 4.3.0 onward, you can use the following,
// which especially useful on shared hosts:
set_include_path('~/pear/lib'. PATH_SEPARATOR
.get_include_path());
?>
Install pear via ftp/ftps/sftp
It is undoubtedly a good idea to install pear on a remote virtual host through ftp or the like. This function is mainly accomplished through pear's package PEAR_RemoteInstaller. There are a few points to be sure:
the machine is PHP 5.0 or above. If you need to use ftps to install, then The native PHP needs to add openssl extension
If you need to use ssh to install, then the local php needs to add ssh2 extension
The pear command line in the php directory is executable
FTP has write permission. Due to time constraints, I will not write down the specific steps for the time being. Friends in need can refer to the link below.
Reference document:
pear manual
Author: volcano Published on September 15, 2006 at 8:40 am
Copyright information: You can reprint at will. When reprinting, please be sure to indicate the original source and author information of the article and this statement in the form of a hyperlink
. Permanent link - http://www .ooso.net/index.php/archives/241