cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

CURLOPT_UPLOAD gives me a Seg Fault

From: Raoul Mackle <raoul_at_nexus.net.nz>
Date: Wed, 15 May 2002 16:52:28 +1200

Hi and greetings to all,

The problem I am having is that PHP is kicking out a seg fault (11) when
trying to upload a file to another web server (as1) for processing before
receiving the output from that server to be stored in the first web servers
DB (ws1).

This diagram demonstrates the process, pretty simple really.

------- ------- ----------------
| ws1 | -> FILE via HTTPPOST -> | as1 | <-> | PROCESS FILE |
------- ------- ----------------
  /|\ |
   | |
    \_____________________________/

This used to go quite well using cURL7.8 but when I upgraded to PHP4.2.0
from PHP4.0.6 I had to also upgrade to cURL7.9. This caused quite a large
problem for me as now using this code here I get a segmentation fault on
ws1.

        $ch = curl_init( $url );
        curl_setopt( $ch, CURLOPT_UPLOAD, true );
        curl_setopt( $ch, CURLOPT_POST, false );
        curl_setopt( $ch, CURLOPT_HTTPPOST, $postData );
        curl_setopt( $ch, CURLOPT_REFERER, $referer );
        curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01;
Windows 98)" );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
        $response = curl_exec( $ch );
        curl_close( $ch );

        return $response;

$postData contains an array consisting of
        $postData[ 'mov' ] = "@".$filename;
        $postData[ 'submit' ] = "UPLOAD";

Through deduction I found that if I commented out the line 'curl_setopt(
$ch, CURLOPT_UPLOAD, true );' it would work (not kill PHP) but however it
would not upload the file (of course) therefore defeating the purpose of
this function anyway.

The environments for both ws1 and as1 are:
RedHat7.2
PHP4.2.0
cURL7.9.6 (OpenSSL 0.9.6b)
Apache1.3.20

If anyone knows or can help that would be very appreciated.

Thank you,

Raoul Mackle

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth_at_sourceforge.net
Received on 2002-05-15