Copy install native pear on a virtual host

Source: Internet
Author: User
Tags command line ftp pear php code ssh

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.