Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52266 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20205 invoked from network); 11 May 2011 03:53:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2011 03:53:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.212.173 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.212.173 mail-px0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:41482] helo=mail-px0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/19-04851-B480ACD4 for ; Tue, 10 May 2011 23:53:47 -0400 Received: by pxi16 with SMTP id 16so92442pxi.32 for ; Tue, 10 May 2011 20:53:44 -0700 (PDT) Received: by 10.68.66.163 with SMTP id g3mr3520784pbt.524.1305086024072; Tue, 10 May 2011 20:53:44 -0700 (PDT) Received: from [192.168.200.140] (c-76-126-236-132.hsd1.ca.comcast.net [76.126.236.132]) by mx.google.com with ESMTPS id i4sm5237023pbr.42.2011.05.10.20.53.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 20:53:42 -0700 (PDT) Message-ID: <4DCA0845.1020506@lerdorf.com> Date: Tue, 10 May 2011 20:53:41 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Gabriel Sosa CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] making system calls from a php extension From: rasmus@lerdorf.com (Rasmus Lerdorf) On 05/10/2011 08:42 PM, Gabriel Sosa wrote: > hello everyone! > > I'm trying to gain some speed by moving a function from PHP legacy > code to C and making an extension. I'm trying to call *lynx* from the > command line since their C api isn't something soo nice likely to use > it as any other libXX If it were me I would take a step back and look at what lynx was actually needed for and whether there are other libraries out there that can do similar things. Like libcurl + the html parsing available in libxml2, for example. I'm assuming you are calling lynx in order to use its html parser? Moving something from PHP to C for performance reasons, but leaving in the call to an external program isn't going to buy you much, if anything, since most of your time is spent forking and launching that external program on each request. -Rasmus