centos下php安装pear模块并配置虚拟主机支持Pear模块

centos下php安装pear模块并配置虚拟主机支持Pear模块
wget http://pear.php.net/go-pear
php go-pear

提示
Sorry! Your PHP version is too new (5.2.14) for this go-pear.
下载新版本

wget http://pear.php.net/go-pear.phar
php go-pear.phar


然后提示

1. Installation base ($prefix)                   : /usr/local/php
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/local/php/bin
 5. PHP code directory ($php_dir)                 : /usr/local/php/share/pear
 6. Documentation directory                       : /usr/local/php/docs
 7. Data directory                                : /usr/local/php/data
 8. User-modifiable configuration files directory : /usr/local/php/cfg
 9. Public Web Files directory                    : /usr/local/php/www
10. Tests directory                               : /usr/local/php/tests
11. Name of configuration file                    : /usr/local/php/etc/pear.conf

1-11, 'all' or Enter to continue:

点击确认默认安装就ok。
然后提示:

Would you like to alter php.ini ? [Y/n] : Y

确认更新php.ini配置文件。

/usr/local/php/bin/pear channel-update pear.php.net
/usr/local/php/bin/pear install HTML_Template_Sigma

可以把/usr/local/php/bin/加入到PATH变量中。

pear install db

Warning: include_once(): open_basedir restriction in effect. File(/usr/share

限制虚拟主机权限? (Y/n):这里请一定要输入“n”,不限制权限,否则将会出现前面所说的“open_basedir restriction in effect”的错误!

修改虚拟主机配置文件httpd-vhosts.conf,如下

<Directory /home/wwhttpd-vhosts.conf
w/default/>^M
Options +Includes -Indexes^M
Require all granted
AllowOverride All^M
php_admin_value open_basedir /home/www/default:/usr/share/pear:/usr/local/pear/share/pear:/tmp:/proc^M
</Directory>^M
</virtualhost>^M
Include conf/vhost/*^M

原文地址:https://www.cnblogs.com/shiningrise/p/2755437.html