php.ini include_path;不能包含PEAR包

时间:2012-02-20 13:39:20

标签: pear php include-path

尝试使用浏览器运行php文件时出错。我猜php.ini文件中的include_path值存在一些问题。 以下是错误 -

  

警告:require_once(System.php)[function.require-once]:无法打开流:第2行/hermes/bosweb/web116/b1166/username/temp/check_pear.php中没有此类文件或目录<登记/>   致命错误:require_once()[function.require]:在/ hermes / bosweb / web116 / b1166 / username / temp /中打开所需的'System.php'(include_path ='。:/ usr / local / bin / php')失败第2行的check_pear.php

我在网络服务器上有这个文件“check_pear.php”,以检查我是否能够包含梨包。

check_pear.php文件的代码是 -
<?php require_once ('System.php'); var_dump(class_exists('System', false)); ?>

我经常搜索并阅读下面的文章,但我仍然无法解决这个问题。 http://pear.php.net/manual/en/installation.checking.php

我没有任何命令行访问我的Web服务器。以下是一些参考信息 -

  

PHP路径:/ usr / local / bin / php
  配置文件(php.ini)路径:/usr/local/lib/php-5.2.17/lib
  解析了其他.ini文件:(无)

在此帮助我。提前谢谢!

1 个答案:

答案 0 :(得分:1)

如果您无法更改php.ini,可以使用

ini_set('include_path',ini_get('include_path').':/var/www/includes:');

位于每个脚本的顶部(只需将其放在一个全局的“公共”文件中),以添加您希望PHP在搜索包含文件时查看的其他路径。

至于该路径应该是什么 - 这取决于服务器的文件结构。

相关问题