我得到我的生產服務器(CentOS的5.4和PHP 5.3.5)在此錯誤:類 'PharData' 未找到
Warning: include_once(PharData.php): failed to open stream: No such file or directory in /var/www/ZendFramework/library/Zend/Loader.php on line 146
Warning: include_once(): Failed opening 'PharData.php' for inclusion (include_path='/var/www/fw:/var/www/vmms:/var/www/ZendFw/library:.:/usr/share/pear:/usr/share/php') in /var/www/ZendFw/library/Zend/Loader.php on line 146
Fatal error: Class 'PharData' not found in /var/www/vm/app/Backup.php on line 40
這是一個失敗的代碼:
$phar = new PharData($imageBackupFile);
$phar->buildFromDirectory($imageDir);
Logger::info("Image directory backed up to: $imageBackupFile");
這代碼在我自己的計算機上正常工作。
PharData應該是默認在PHP 5.3+包括...
感謝您的幫助!
UPDATE:
我使用Zend自動加載功能來加載使用此代碼良好的PHP文件:
require_once("Zend/Loader/Autoloader.php");
$autoloader = Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
的Zend自動加載機是做include_once(PharData.php)
。
您可以在這裏看到,自5.3版本以來,PharData包含在php中:http://www.php.net/manual/en/phar.installation.php – benjisail