Home > php教程 > php手册 > 创建本地的PEAR

创建本地的PEAR

WBOY
Release: 2016-06-13 10:35:15
Original
1480 people have browsed it

在某些主机上,你可能没有修改系统缺省安装pear的权限,但是又希望安装自己的pear包。这种情况下也有简单的办法实现:

首先在自己的home下创建一份pear的配置文件.pearrc:
$ pear config-create $HOME .pearrc

如果一切顺利的话,直接进行下一步,否则运行一下下列命令:
$ pear config-set download_dir /home/(username)/tmp/pear/cache
$ pear config-set cache_dir /home/(username)/tmp/pear/cache
$ pear config-set temp_dir /home/(username)/tmp/pear/temp


接着就可以开始安装pear了,这会连着pear的依赖文件一块安装:
$ pear install -o PEAR

经过这一步,pear已经安装完成,如果你还希望安装其它的package,那么:
$ pear install pear/PackageName

这样你就有了一份自己定制的pear包,为了在程序中调用到这些pear,你需要多谢写一些额外的代码,毕竟这些代码还不在你的include_path中。

php4

PLAIN TEXT
CODE:
ini_set(
 include_path,
  ini_get(include_path).PATH_SEPARATOR."/home/(youruser)/pear/php"
);
php5

PLAIN TEXT
CODE:
set_include_path(
    get_include_path().
   PATH_SEPARATOR./home/(youruser)/pear/php
);
作者:volcano发表于6月 16, 2007 at 7:46 am

版权信息:可以任意转载, 转载时请务必以超链接形式标明文章原始出处和作者信息及此声明

永久链接 - http://www.ooso.net/index.php/archives/327

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template