无法在ubuntu php 5.3中创建phar

时间:2016-08-26 06:44:44

标签: php archive phar

我创建了create-phar.php文件,如下所示

<?php

$srcRoot = getcwd() ."~/Caching";
$buildRoot = getcwd() ."~/Caching/build";

$phar = new Phar($buildRoot . "/cache.phar", 
    FilesystemIterator::CURRENT_AS_FILEINFO |       
    FilesystemIterator::KEY_AS_FILENAME, "cache.phar");

$phar["config.php"] = file_get_contents($srcRoot . "config/config.php");
$phar["Cache.php"] = file_get_contents($srcRoot . "/Cache.php");
$phar["CacheFactory.php"] = file_get_contents($srcRoot . "/CacheFactory.php");
$phar["CacheManager.php"] = file_get_contents($srcRoot . "/CacheManager.php");
$phar["CacheResponse.php"] = file_get_contents($srcRoot . "/CacheResponse.php");
$phar["NamespaceRule.php"] = file_get_contents($srcRoot . "/NamespaceRule.php");
$phar["RedisCache.php"] = file_get_contents($srcRoot . "/RedisCache.php");
$phar->setStub($phar->createDefaultStub("CacheManager.php"));
?>

当我运行它时,我收到以下消息:

PHP Warning:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '/home/pramendrar/sandbox/LME_SERVICES/Caching~/Caching/build/cache.phar', file extension (or combination) not recognised' in /home/pramendrar/sandbox/LME_SERVICES/Caching/create-phar.php:7
Stack trace:
#0 /home/pramendrar/sandbox/LME_SERVICES/Caching/create-phar.php(7): Phar->__construct('/home/pramendra...', 256, 'cache.phar')
#1 {main}
thrown in /home/pramendrar/sandbox/LME_SERVICES/Caching/create-phar.php on line 7

0 个答案:

没有答案