douyue1926 2010-04-22 01:37
浏览 11
已采纳

apc_delete()无法在后台脚本中工作

I have a shell background convertor on my video website and I can't seem to get APC to delete a key as a file is uploaded and its visibility is updated. The script is structured like so:

if(file_exists($output_file))
{ 
   $conn->query("UPDATE `foo` SET `bar` = 1 WHERE `id` = ".$id." LIMIT 1"); 
   apc_delete('feed:'.$id); 
}

Everything works fine except for the APC and this is the only script on the site that has had this problem. I'm stumped.

  • 写回答

1条回答 默认 最新

  • duanbiao4025 2010-04-22 01:43
    关注

    You can't access the APC shared memory segment inside of apache from a process external to apache. If you enable APC in CLI mode, CLI scripts simply receive their own shared memory segments.

    You can work around this by:

    1. Using memcached instead of APC, which is accessible from anywhere, not just a single apache instance
    2. Exposing a URL (e.g. http://example.com/delete.php?id=5) which you can call from your CLI script. The URL will be processed by a script inside of apache, and as such, have access to APC.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 使用Java milo连接Kepserver服务端报错?
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了
  • ¥15 微信小程序商城如何实现多商户收款 平台分润抽成