PEAR完全安装以及错误处理

 昨天本来想用pear加载一个HTML_quickForm2的表格模块的但是总是会出现许多的错误  在windows7下安装运行go-pear.bat的时候会提示到:“……~\Zend\ZendServer\bin\PEAR\go-pear.phar does not have a signature”按任意键继续这个提示!最后知道是要修改…..\Zend\ZendServer\bin\go-pear.bat的内容,右键编辑,把内容替换为以下:

@ECHO OFF
 set PHP_BIN=php.exe
 rem %PHP_BIN% -d output_buffering=0 PEAR\go-pear.phar
 %PHP_BIN% -d phar.require_hash=0 PEAR\go-pear.phar
  pause

保存双击击就可以安装pear了!按照提示设置。一直点击enter遇到yes/no输出y安装!

最后打开windows目录下的php.ini文件,然后查找到如下的地方:

  ; UNIX: “/path1:/path2″
  ;include_path = “.:/php/includes”
  ;
  ; Windows: “path1;path2″
  ;include_path = “.;c:phpincludes”
  把最后一行的注释去掉,然后把后面路径改成你的PEAR路径,例如:
  include_path = “.;c:phppear”
  保存PHP.INI。
然后双击和go-pear.bat同文件夹下生成的PEAR_ENV.reg注册表文件,导入注册表,重新启动APACHE即可。

pear安装好后(用运行-》CMD -》pear list可以查看是否安装好)运行pear install HTML_QuickForm2 安装模块又出现了很多错误(这个安装之前还要首先安装HTML_Common2):如下

Warning: strtotime(): 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 PEAR\Validate.php on line 489
downloading HTML_Common-1.2.5.tgz …
Starting to download HTML_Common-1.2.5.tgz (4,585 bytes)
…done: 4,585 bytes

Warning: strtotime(): 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 PEAR\Validate.php on line 489

Warning: require_once(Structures/Graph.php): failed to open stream: No such file
 or directory in PEAR\Downloader.php on line 1230

Warning: require_once(): It is not safe to rely on the system’s timezone setting
s. You are *required* to use the date.timezone setting or the date_default_timez
one_set() function. In case you used any of those methods and you are still gett
ing this warning, you most likely misspelled the timezone identifier. We selecte
d ‘UTC’ for ’8.0/no DST’ instead in PEAR\Downloader.php on line 1230

解决办法:

对于You are *required* to use the date.timezone setting or the date_default_timezone
_set() function.只要修改php.ini就可以了 查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC

没有了怎么办,那就直接添加到php.in就可以了,然后重启apache。

Warning: require_once(Structures/Graph.php): failed to open stream: No such file or directory in PEAR\Downloader.php on line 1230这个的解决办法:

1.下载并解压缩 Structures_Graph-1.0.3,从 pear.php.net 网站。

2.手动安装文件包Structures_Graph-1.0.3,选择里边的Structures文件夹拷贝到指定的PEAR目录,如果不知道的话运行-》CMD-》pear config-show找到 ”PEAR directory php_dir”,拷贝到这个对应的目录下就可以了(我的是ProgramFiles\Zend\ZendServer\bin\PEAR)下,重启apache。然后运行  pear install Structures_Graph安装,虽然说没有安装,如下:

C:\Users\Administrator>pear install Structures_Graph
downloading Structures_Graph-1.0.4.tgz …
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
………done: 30,318 bytes
install ok: channel://pear.php.net/Structures_Graph-1.0.4

没有出现错误啦!而且升级到1.0.4了呵呵!仿照这个方法如果升级错误,就手动安装吧!也可以动手升级可以升级的pear,

运行pear upgrade PRAR升级pear。到这里也就算安装好了!让我们来看一个实例吧!

用HTML_QuickForm2加载一个表格!

   
   
   
   
  1. ><?php   
  2.   require_once "HTML/QuickForm2.php";   
  3.   require_once 'HTML/QuickForm2/Renderer.php';   
  4.   $format = array(   
  5.       ''     => 'Newsletter Format:',   
  6.       'text' => 'Text',   
  7.       'html' => 'HTML' 
  8.   );   
  9.   $form = new HTML_QuickForm2('newsletter');   
  10.   $name = $form->addText('name')->setLabel('Your Name:');   
  11.   $email = $form->addText('email')->setLabel('Your E-mail Address:');   
  12.   $newsletter = $form->addSelect('format', null, array('options' => $format));   
  13.   $newsletter->setLabel('Preferred Newsletter Format:');   
  14.   $form->addElement('submit', null, 'Submit!');   
  15.   $renderer = HTML_QuickForm2_Renderer::factory('default');   
  16.   echo $form->render($renderer);   
  17. ?> 
     Apache启动失败故障排除 今天学了很牛逼的一招, 打开运行,输入eventvwr.msc查看一下系统日志——应用程序的日志。这时候我们发现有很多错误,查找并打开你刚才遇到的Apache的错误日志,找出来对应的修改下!就好了!!! www.phpec.net转载请说明出处。

你可能感兴趣的:(职场,PEAR,错误处理,休闲)