Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46764 Return-Path: <0xcafefeed@gmail.com> Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69887 invoked from network); 17 Jan 2010 06:35:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2010 06:35:33 -0000 Authentication-Results: pb1.pair.com header.from=0xcafefeed@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=0xcafefeed@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.226 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: 0xcafefeed@gmail.com X-Host-Fingerprint: 209.85.219.226 mail-ew0-f226.google.com Received: from [209.85.219.226] ([209.85.219.226:40387] helo=mail-ew0-f226.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/57-27028-4BFA25B4 for ; Sun, 17 Jan 2010 01:35:32 -0500 Received: by ewy26 with SMTP id 26so2358198ewy.23 for ; Sat, 16 Jan 2010 22:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MsYLEVBb1mqd0P8Tn3KHt8Aj5nBQGimqNv8iHlNnRhk=; b=wDE/M9T8ccWGebjkLjN4vHjdEbDZunKgBSdlE3kF+TPw2aCI4CkkFu/hIr1ISAYyEj uvhghqjNYOm+TXsZK7X9H9YuqIlwdI6BKkRhkERqq22eh6jVKsfSsxCAaNef5hPmXyuk 2+Pfm6MHFCICqtnbpaqgm//2dO2zi7R2+FZhk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wNZkn8255VnNJmvDyOukNiKDbOlk8AHHEJntbW3E3gvr1UHcQv56ZhQckM7DpKRGnY 3nxDWWArAqkIA0sld8979HUZbV4bXBwQ7FtQZnhwyZ9Nif4jiiiliCDJBbCGn2ZVbswR Sic/IoqACM4mPhCI9IbQxbcXUE4U65r++/aXY= MIME-Version: 1.0 Received: by 10.216.86.3 with SMTP id v3mr1599238wee.165.1263710129306; Sat, 16 Jan 2010 22:35:29 -0800 (PST) In-Reply-To: References: <134308.42725.qm@web56707.mail.re3.yahoo.com> Date: Sat, 16 Jan 2010 22:35:29 -0800 Message-ID: To: "Brian J. France" Cc: rwe rt , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Can we call Apache 2 API function from a PHP 5 extension module? From: 0xcafefeed@gmail.com (mm w) yep nevermind I don't you post this question on php-internal and don't understand this ugly suggestion, Brian when I read your cv it seems to be something serious ... when I see the line with your type recasting I am not sure you understood something during these 15 years. Best On Sat, Jan 16, 2010 at 10:05 PM, Brian J. France w= rote: > Try this instead: > > request_rec *r =3D (request_rec *)(((SG(server_context) =3D=3D NULL) ? NU= LL : ((php_struct*)SG(server_context))->r)); > > Apache 2.x server_context is not a request_rec, it is a struct with a req= uest rec in it. > > Brian > > > On Jan 16, 2010, at 7:25 PM, rwe rt wrote: > >> Hi all,I compiled php-5.3.1 with apache 2.2.14 as DSO and wanted to test= how to call Apache API from a PHP module:Run ./ext_skel --extname=3DhelloM= odified ext/hello.c and the function PHP_FUNCTION(confirm_hello_compiled) s= o that it contains >> >> #include "SAPI.h" >> #include "httpd.h" >> #include "http_config.h" >> #include "http_protocol.h" >> #include "ap_config.h" >> request_rec *hello_r;PHP_FUNCTION(confirm_hello_compiled) { hello_r =3D = (request_rec *)SG(server_context); ap_rprintf(hello_r, "Hello world\n"); = =C2=A0 =C2=A0return SUCCESS; >> }Under php root, run ./buildconf and ./configure --with-apxs=3D/home/www= /bin/apxs --enable-helloIt worked fine. But when I furhter ran: >> >> makeI got an error like:....ext/hello/.libs/hello.o: In function zif_con= firm_hello_compiled': /home/www/php-5.3.1/ext/hello/hello.c:167: undefined = reference toap_rprintf'near the end of compiling.As far as I know, PHP 5 ca= n only be compiled as DSO and don't have access to compiled objects in Apac= he 2 directly. How to modify config.m4 or other files so that I can make co= mpiling successful? Any help would be greatly appreciated!Rwe >> >> >> =C2=A0 =C2=A0 =C2=A0____________________________________________________= ______________ >> Be smarter than spam. See how smart SpamGuard is at giving junk email th= e boot with the All-new Yahoo! Mail. =C2=A0Click on Options in Mail and swi= tch to New Mail today or register for free at http://mail.yahoo.ca > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >