2013-02-20 102 views
0

我無法緩存SimpleXMLElement對象數組。這是apc_store行失敗,我不知道爲什麼。APC緩存SimpleXMLElement對象數組

程序終止在這一行,這很奇怪,因爲我在別處使用過它---在ArrayObject中包裝數組並將其存儲在緩存中。

我的代碼提取低於:

$feed = /* some url */ 
    $xml = simplexml_load_file($feed); 
    $items = $xml -> xpath('/rss//item'); 

    foreach($items as $item){ 
     $item -> addChild('myTag1', "My Tag 1"); 
     $item -> addChild('myTag2', "My Tag 2"); 
    } 

    apc_store($feed, new ArrayObject($items), 60); 

我不認爲我的日誌文件被正確地工作,這是最後一個條目,以防萬一它可以幫助,但我認爲這是與SSL和不該做這裏有幫助:

[Wed Feb 20 12:21:51 2013] [notice] caught SIGTERM, shutting down 
Attempt to free unreferenced scalar: SV 0x7fe7805e2130, Perl interpreter: 0x7fe7805ea4f0 during global destruction. 
[Wed Feb 20 12:21:54 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) 
[Wed Feb 20 12:21:54 2013] [notice] SSL FIPS mode disabled 
Attempt to free unreferenced scalar: SV 0x7f94bfa75ec0, Perl interpreter: 0x7f94bfa56550 during global destruction. 
[Wed Feb 20 12:21:57 2013] [notice] Digest: generating secret for digest authentication ... 
[Wed Feb 20 12:21:57 2013] [notice] Digest: done 
[Wed Feb 20 12:21:59 2013] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads. 
[Wed Feb 20 12:21:59 2013] [notice] mod_python: using mutex_directory /tmp 
[Wed Feb 20 12:21:59 2013] [notice] SSL FIPS mode disabled 
[Wed Feb 20 12:21:59 2013] [notice] Apache/2.2.22 (Unix) DAV/2 PHP/5.4.10 mod_python/3.3.1 Python/2.7.3 mod_ssl/2.2.22 OpenSSL/1.0.0j-fips mod_perl/2.0.5 Perl/v5.14.3 configured -- resuming normal operations 

感謝您的幫助。

回答

0

在上面的示例中,$ feed不是url的字符串表示形式;它是一個數組,其第一個元素是一個url的字符串表示。此外,我還使用命名空間,因此ArrayObject需要一個斜槓前綴。