douhuireng4407 2009-07-31 02:30
浏览 301
已采纳

从PHP exec()调用时cURL失败

I'm making a call to download an XML file and write it to a file using exec() and the curl command. I tried using curl_exec(), but it wasn't recognized by my PHP system.

Somehow, the cURL call now fails. It didn't before, but one day I visit my site and– WHAM. Bye bye XML parser.

Things that did work:

  • Calling cURL from the command line with the same argument.
  • exec("ls /");

Things that didn't work:

  • which curl, then completing the path to the cURL in my exec function.
  • Googling the error that the curl throws when I output the errors from the exec function

    ld.so.1: curl: fatal: /opt/csw/lib/libsunmath.so.1: unknown file type

  • Using shell_exec

  • Using wget hung the script somehow. Just never finished.
  • Self-flagellation
  • 写回答

1条回答 默认 最新

  • douchen7555 2009-07-31 04:09
    关注

    I managed to code around the problem. I found out that the script was hanging with wget because a server wasn't responding. Bummer, but removing that link fixed my issue.

    It's sad because the way I was using cURL was much cleaner for IO. Fortunately this update checks input before changing files. This now creates a temporary file that wget downloads to and then checks to make sure it's the right format before moving the file to its new location.

    An ordeal, to be sure, but lots of good things to come of it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn