无法运行Phar档案 [英] Cannot run Phar archives
本文介绍了无法运行Phar档案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在RHEL服务器上,我似乎无法运行PhpUnit.以下是作为根目录的示例,以说明我尝试安装PhpUnit的步骤以及该步骤如何运行:
On a RHEL server I cannot seem to run PhpUnit. Here are examples as root to illustrate the steps that I've tried to install PhpUnit and how it does not run:
# wget https://phar.phpunit.de/phpunit.phar
# chmod +x phpunit.phar
# ./phpunit --version
PHP Fatal error: require(): Failed opening required 'phar://phpunit-4.3.4.phar/phpunit/TextUI/Command.php' (include_path='.:') in /usr/local/bin/phpunit on line 592
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. {closure}() /usr/local/bin/phpunit:0
# mv phpunit.phar /usr/local/bin/phpunit
# which phpunit
/usr/local/bin/phpunit
# phpunit --version
PHP Fatal error: require(): Failed opening required 'phar://phpunit-4.3.4.phar/phpunit/TextUI/Command.php' (include_path='.:') in /usr/local/bin/phpunit on line 592
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. {closure}() /usr/local/bin/phpunit:0
PHP似乎阻塞了第13行定义的phar://
地址格式:
It seems that PHP is choking on the phar://
address format defined on line 13:
# cat /usr/local/bin/phpunit | awk 'NR==592'
require __PHPUNIT_PHAR_ROOT__ . $classes[$class];
# cat /usr/local/bin/phpunit | grep -n __PHPUNIT_PHAR_ROOT__
13:define('__PHPUNIT_PHAR_ROOT__', 'phar://phpunit-4.3.4.phar');
592: require __PHPUNIT_PHAR_ROOT__ . $classes[$class];
601: print file_get_contents(__PHPUNIT_PHAR_ROOT__ . '/manifest.txt');
20811: if (defined('__PHPUNIT_PHAR_ROOT__')) {
20812: $prefix = __PHPUNIT_PHAR_ROOT__;
26020: copy(__PHPUNIT_PHAR_ROOT__ . '/ca.pem', $caFile);
服务器为RHEL 6.5:
The server is RHEL 6.5:
# uname -a
Linux foobar 2.6.32-220.38.1.el6.x86_64 #1 SMP Wed May 15 08:34:56 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Kernel \r on an \m
推荐答案
解决方案是仅使用PEAR中的PHPUnit,它也不会因以下错误而运行:
The solution was to just use PHPUnit from PEAR, which also would not run with this error:
[root@panthercrm ~]# /usr/bin/phpunit
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/share/pear/PHPUnit/
Autoload.php on line 64
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. require() /usr/bin/phpunit:43
PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:') in /usr/share/pear/PHPUni
t/Autoload.php on line 64
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. require() /usr/bin/phpunit:43
在/etc/php.ini
中添加以下行解决了PEAR版本的PHPUnit的问题:
Adding the following line to /etc/php.ini
resolved the issue for the PEAR version of PHPUnit:
include_path = ".:/usr/share/pear"
这篇关于无法运行Phar档案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文