Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46762 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66255 invoked from network); 17 Jan 2010 06:05:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2010 06:05:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=brian@brianfrance.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=brian@brianfrance.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain brianfrance.com from 208.83.223.140 cause and error) X-PHP-List-Original-Sender: brian@brianfrance.com X-Host-Fingerprint: 208.83.223.140 ls6.firehawksystems.com Received: from [208.83.223.140] ([208.83.223.140:49546] helo=ls6.firehawksystems.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/A6-27028-3A8A25B4 for ; Sun, 17 Jan 2010 01:05:24 -0500 Received: from mbp-wireless.brianfrance.com (adsl-99-162-53-160.dsl.ipltin.sbcglobal.net [99.162.53.160]) (authenticated bits=0) by ls6.firehawksystems.com (8.14.3/8.14.3) with ESMTP id o0H65Hxf045297 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 16 Jan 2010 22:05:20 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii In-Reply-To: <134308.42725.qm@web56707.mail.re3.yahoo.com> Date: Sun, 17 Jan 2010 01:05:17 -0500 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <134308.42725.qm@web56707.mail.re3.yahoo.com> To: rwe rt X-Mailer: Apple Mail (2.1077) X-Virus-Scanned: clamav-milter 0.95.1 at ls6.firehawksystems.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] Can we call Apache 2 API function from a PHP 5 extension module? From: brian@brianfrance.com ("Brian J. France") Try this instead: request_rec *r =3D (request_rec *)(((SG(server_context) =3D=3D NULL) ? = NULL : ((php_struct*)SG(server_context))->r)); Apache 2.x server_context is not a request_rec, it is a struct with a = request 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=3DhelloModified ext/hello.c and the function = PHP_FUNCTION(confirm_hello_compiled) so that it contains >=20 > #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"); = return SUCCESS; > }Under php root, run ./buildconf and ./configure = --with-apxs=3D/home/www/bin/apxs --enable-helloIt worked fine. But when = I furhter ran: >=20 > makeI got an error like:....ext/hello/.libs/hello.o: In function = zif_confirm_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 can only be compiled as DSO and don't have access to = compiled objects in Apache 2 directly. How to modify config.m4 or other = files so that I can make compiling successful? Any help would be greatly = appreciated!Rwe >=20 >=20 > = __________________________________________________________________ > Be smarter than spam. See how smart SpamGuard is at giving junk email = the boot with the All-new Yahoo! Mail. Click on Options in Mail and = switch to New Mail today or register for free at http://mail.yahoo.ca