On the domestic leased virtual host, some hosts themselves provide the Pear class library, but do not expect them to upgrade or install the required pear package. In this case, you can try installing a pear under your own virtual host.
Install pear with SSH
Most of the domestic virtual host does not provide SSH, but if a friend of the server, may be more relaxed to give you the right. See below for the steps to install pear on a virtual host via 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 more than 1.4:
$ pear config-create/home/user/pear. PEARRC
This creates a. pearrc file in the user's home
Add in the. bashrc file
PEAR 1.3.2 or below:
$ pear -c ~/.pearrc install Archive_Tar PEAR Console_Getopt XML_RPC
PEAR 1.3.3以上
$ pear install -o PEAR
This adds a pear directory to the user's home directory, which is a fully replicated pear on the host.
In order to use this pear package that you just installed, you need to specify the include_path in the PHP code
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 with ftp/ftps/sftp
Installing pear on a remote virtual host, such as FTP, is certainly a good idea. This is done primarily through Pear's package pear_remoteinstaller. There are a few points to determine:
This machine is more than 5.0 PHP
If you need to install with FTPs, then native PHP needs to add OpenSSL extension
If you need to install with SSH, then native PHP needs to add SSH2 extension
The Pear command line executable in the PHP directory
FTP has Write permissions