質問

I have installed Console_CommandLine using pyrus:

php pyrus.phar install pear/Console_CommandLine

the directory where Console_CommandLine was installed has the next structure: (/A_PATH/lib/)

lib/
├── cache
├── data
├── docs
├── downloads
├── php
└── tests

I've tried the next: (/A_PATH/demo.php)

<?php
    require_once 'lib/Console_CommandLine/php/Console/CommandLine.php';
    ...
 ?>

but I have the next error:

PHP Warning:  require_once(Console/CommandLine/Exception.php): failed to open stream: No such file or directory in /A_PATH/lib/Console_CommandLine/php/Console/CommandLine.php on line 32
PHP Fatal error:  require_once(): Failed opening required 'Console/CommandLine/Exception.php' (include_path='.:/usr/share/php:/usr/share/pear') in /A_PATH/lib/Console_CommandLine/php/Console/CommandLine.php on line 32

How can I use the CommandLine.php file for my personal project?

役に立ちましたか?

解決

You need to setup your include path. PEAR packages rely on it being set correctly, so that their includes work properly:

set_include_path('.:/A_PATH/lib/php/');

You can also set that in your php.ini, which is how it's done most times.

A howto to setup your include path can be found in the PEAR 1 manual: http://pear.php.net/manual/en/installation.checking.php

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top