- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章PHP pear安装配置教程由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
什么是PEAR?
PEAR是PHP扩展与应用库(the PHP Extension and Application Repository)的缩写。它是一个PHP扩展及应用的一个代码仓库,简单地说,PEAR之于PHP就像是CPAN(Comprehensive Perl Archive Network)之于Perl.
由此可见PEAR是PHP代码的仓库,在这里可以找到很多有用的代码,避免我们重复写一些功能,但是PEAR代码包并不是直接通过HTTP网站下载的,我们需要安装PEAR.
如何获取并安装PEAR 。
建议:下面操作在Windows 7环境下完成,同样适用于Windows XP/2003/Vista/2008系统,部分操作带有尝试性,为了避免弯路,建议先看完本文,然后再进行相关操作.
如果PHP目录下没有自带PEAR,即找不到go-pear.php文件,那么就需要我们手动下载go-pear.php文件,点击这里下载并另存为go-pear.php,这个文件放到php.exe所在的PHP安装目录下,我这里安装目录是D:\php5(下文以此目录为准),那么go-pear.php的位置应该是D:\php5\go-pear.php.
开始 – 运行,输入cmd,启动命令提示符,输入以下命令,主要是切换到go-pear.php目录下,然后执行这个PHP脚本文件:
cd D:\php5 D: php go-pear.php 遗憾的是可能由于我的PHP版本太新,上述操作提示失败,具体的信息如下:
Deprecated: Assigning the return value of new by reference is deprecated in D:\php5\go-pear.php on line 733 。
Sorry! Your PHP version is too new (5.3.8) for this go-pear. 。
Instead use http://pear.php.net/go-pear.phar for a more stable and current version of go-pear, more suited to your PHP version. 。
Thank you for your coopertion and sorry for the inconvenience.
意思是要求我们到http://pear.php.net/go-pear.phar下载go-pear.phar文件,然后取代go-pear.php再试。下载好go-pear.phar文件并放到D:\php5文件夹中,执行下面的命令:
cd D:\php5 D: php go-pear.phar 这时出现:
Are you installing a system-wide PEAR or a local copy? (system|local) [system] : 按回车默认system然后继续。以下是默认的pear的临时、数据、配置、测试、执行目录的设置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Below is a suggested file layout
for
your
new
PEAR installation. To
change individual locations, type the number in front of the
directory. Type
'all'
to change all of them
or
simply press Enter to
accept these locations.
1. Installation base (
$prefix
) : D:\php5
2. Temporary directory
for
processing : D:\php5\tmp
3. Temporary directory
for
downloads : D:\php5\tmp
4. Binaries directory : D:\php5
5. PHP code directory (
$php_dir
) : D:\php5\pear
6. Documentation directory : D:\php5\docs
7. Data directory : D:\php5\data
8. User-modifiable configuration files directory : D:\php5\cfg
9. Public Web Files directory : D:\php5\www
10. Tests directory : D:\php5\tests
11. Name of configuration file : C:\Windows\pear.ini
12. Path to CLI php.exe : D:\php5
1-12,
'all'
or
Enter to
continue
:
|
直接回车使用默认值然后继续安装。本来以为万事大吉的,可是偏偏在这里出现了错误:
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC' for '8.0/no DST' instead in phar://D:/php5/go-pear.phar/PEAR/Registry.php on line 1012 PEAR_Config::writeConfigFile fopen(‘C:\Windows\pear.ini','w') failed (fopen(C:\Windows\pear.ini): failed to open stream: Permission denied) 。
看样子是没有权限写入C:\Windows\pear.ini,由于我使用的是Windows 7系统,然后普通用户打开的命令提示符,在这里当然没有权限写入C:\Windows目录了,看来要另辟蹊径了。回到刚才Are you installing a system-wide PEAR or a local copy?这段,为什么不选择local copy呢?网上都是直接说默认回车选择system的,不想改写C:\Windows目录,于是我重新执行php go-pear.phar,并且选择local.
Are you installing a system-wide PEAR or a local copy? (system|local) [system] : local Please confirm local copy by typing 'yes' : yes 。
好了,这下正常了:-) 。
Would you like to alter php.ini <D:\php5\php.ini>? [Y/n] : 然后就是上面这句,只有选择Y同意修改php.ini.
1
2
3
4
5
6
|
php.ini <D:\php5\php.ini> include_path updated.
Current
include
path : .;C:\php\pear
Configured directory : D:\php5\pear
Currently used php.ini (guess) : D:\php5\php.ini
Press Enter to
continue
:
|
接着出现上面这段,看来没有什么好改的,直接回车确认即可.
到这里应该能看到Thanks for using go-pear!这句了,那么恭喜你,PEAR总算是安装成功了! 。
如何安装PEAR Package包 。
接下来让我们去PEAR网站上看看有什么需要的吧。PEAR每个包都有安装命令的提示,比如说MDB2这个包,上面已经提示使用pear install MDB2命令安装了,假设目录还是D:\php5,那么我们利用下面的命令试试:
cd D:\php5 D: pear install MDB2 结果出现下面这个错误:
1
2
3
4
5
|
D:\php5>pear install MDB2
downloading MDB2-2.4.1.tgz ...
Starting to download MDB2-2.4.1.tgz (119,790 bytes)
..........................done: 119,790 bytes
ERROR: failed to
mkdir
C:\php\pear\docs\MDB2\docs\examples
|
无法创建目录,看来又是权限问题,索性以管理员身份启动cmd命令提示符,然后重新执行上面的命令。这次总算安装成功了install ok! 。
另一个安装报错案例:PHP pear安装出现 Warning: require_once(Structures/Graph.php)...错误 。
在WINDOWS安装pear,一路无阻很顺利安装完成,接着想安装下pear email包来玩下,但接下来却报:
Warning: require_once(Structures/Graph.php): failed to open stream: No such file or directory in PEAR\Downloader.php on line 1217 PHP Warning: require_once(Structures/Graph.php): failed to open stream: No such file or directory in E:\Program Files\php5_3\pear\pear\PEAR\Downloader.php on l ine 1217 新手没办法,网上找解决。折腾了老半天,还是报这错误.原因很清楚就是少了Structures_Graph这个PEAR应用,相直接通用pear命令: pear install Structures_Graph-1.1.1 在线安装这个应用,但让人痛心的是竟然也报同样的错误,我丢。.
不跟它玩了直接到PEAR官网下载Structures_Graph-1.1.0.tgz包。解压看看里面的结构;发现里面正好有一个Structures/Graph.php;于是解压并把压缩包里的Structures文件夹放到pear根目下面。接着再运行Structures_Graph的安装命令,惊喜!!成功了.
接着再安装email,不出意外也成功。到此这个纠结了我半天的问题终于解决了.
谢谢大家的阅读哦! 。
最后此篇关于PHP pear安装配置教程的文章就讲到这里了,如果你想了解更多关于PHP pear安装配置教程的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我听说最好不要从您系统的 Perl 版本所在的 CPAN 安装模块。我知道如何使用命令行安装模块,我只是想知道是否有办法将 CPAN 与系统核心 Perl 分开。 我应该: 下载源代码并专门为这些模块
我听说最好不要从系统的 Perl 版本所在的 CPAN 安装模块。我知道如何使用命令行安装模块,我只是想知道是否有办法将 CPAN 与系统的核心 Perl 分开。 我应该: 下载源代码并专门为这些模块
单独安装 electron 与通过 electron-builder 安装有什么区别?我正在使用 React 构建一个 Electron 应用程序,并且已经找到了一些教程。它们安装 Electron
两者安装有什么区别?我按照安装页面上的说明在全局范围内安装了 webpack,然后我转到了入门指南,据说在那里可以在本地安装 webpack-cli。 CLI = Command Line Inter
我在 OS X Yosemite 上用 PHP 安装了默认的 Apache 服务器,安装了 pear,用 brew 安装了 Solr (brew install solr),现在我正在尝试使用 PEC
我解压并编译了 Ruby 2.1 并安装了几个支持工具。 但是当我安装了 libssl-dev 时,OpenSSL 不会安装。 我在支持 openssl 时遇到这个错误: make: *** No r
我在 android studio 2.3.1 和 gradle 3.2 中设计了 2 到 3 个应用程序。当我从它运行应用程序到任何设备或模拟器时,一切都工作正常。但是当我从构建文件夹中获取该 ap
我注意到我正在读一本书提到通过 apt-get 安装 numpy 和 opencv apt-get install python-numpy python-opencv 但我可以通过以下方式在 pip
我正在尝试在 Windows 8.1 上安装 ansicon。我提取了文件并达到了我需要调用 ansicon -i 的级别。当我在 cmd 中输入此内容并运行 python 脚本时效果很好,但是当我通
我有 linux MINT 17.3 Kernel 4.4.0-81 所有更新可用。 (由于不同的原因,我无法迁移到更新版本的 ubuntu/mint) 我已经通过 PPA 安装了 FFMPEG(不是
尝试在本地运行我的应用程序时出现错误: 我只在 chrome 浏览器中收到此错误。我尝试过不同的东西,但我不确定为什么它是 Chrome 特定的。 最佳答案 我怀疑这不是 Firebase 问题,而是
这是我第一次开发 AngularJS 应用程序并使用脚手架工具 Yeoman ( http://yeoman.io/ )。我想对我的一些图标使用 fontawesome ( http://fortaw
我知道您通常“应该”$ pip install 如果包没有 brew ,但如果有一个你想安装的 python 包,你可以使用 $ pip install或 $ brew install为了?例如,通过
我正在尝试通过 RVM 安装 Ruby 1.9.3。然而,当谈到安装 RubyGems 时,我得到了这个: curl: (22) The requested URL returned error: 4
我是真正提出问题的新手,但你去吧。 我一直在尝试按照安装指南添加 dnsname: https://github.com/containers/dnsname https://github.com/c
Studio更新至0.4.0 建筑产量为“需要1.8版Gradle”;将设置设置为1.8 bin目录; 建立 “要求1.9级”;将设置设置为1.9 bin; 建立 “要求1.8级” 啊。不知道该怎么做
我刚刚注意到 kernel.org 因维护而停机。是否有使用不同镜子的不同公式?或者我可以向 Homebrew 软件添加不同的来源(如 bundler ?)? 谢谢你的帮助! 最佳答案 快速解决方法:
当我运行时: peardev install phpunit/PHPUnit 我得到以下信息: No releases available for package "pear.phpunit.de/P
服务器操作系统为Fedora 24. 64bit。 我想安装 Git 2.6.6。 所以下载源码并安装。 此服务器离线。所以我不使用“yum”。 ./configure --prefix=/usr/l
我正在尝试在我自己的服务器(操作系统:Linux Ubuntu Server 12.04)上安装 OpenEdX,但我遇到了同样的错误。谁能帮帮我? TASK: [ insights | insta
我是一名优秀的程序员,十分优秀!