Question

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
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top