You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jean-Sebastien Delfino <js...@apache.org> on 2007/01/10 08:53:25 UTC

Re: [PHP] Building the PHP runtime and SCA extension

Simon Laws wrote:
> On 1/9/07, Jean-Sebastien Delfino <js...@apache.org> wrote:
>>
>> Simon Laws wrote:
>> > Ok, so after a rather lengthy (and relaxing) Christmas break I'm
>> > starting to
>> > work again on building up the PHP capability in the C++ SCA
>> > implementation.
>> > There was some work done before Christmas documented on our PHP SCA 
>> site
>> > here [1]. There were some previous mail exchanges talking about the
>> > problem
>> > generally [2] and talking about the slight discontinuity between 
>> the way
>> > that composition is represented in PHP SCA annotations compared to the
>> > SCA
>> > SCDL files in C++ SCA [3].
>> >
>> > The first thing I'm going to do is get the existing C++ PHP Extension
>> > up and
>> > running again and submit any changes that are required now that C++
>> > SCA has
>> > moved on and I'm on to a new version of PHP. I'll add some more detail
>> to
>> > the README about what to do. This note was just to get the ball 
>> rolling
>> > again so I'm sure there will be lots more issues to discuss very
>> shortly.
>> >
>> > Regards
>> >
>> > Simon
>> >
>> > [1] -
>> > http://www.osoa.org/display/PHP/PHP+SCA+Extension+For+Tuscany+CPP+SCA
>> > [2] -
>> > http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg11572.html
>> > [3] -
>> > http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg11747.html
>> >
>>
>> Simon,
>>
>> How are you building the PHP runtime to work both with the PHP SCA_SDO
>> package at http://pecl.php.net/package/SCA_SDO and the Tuscany PHP
>> extension?
>>
>> I built PHP 5.2.0 on my Linux box like this:
>> ./configure --prefix=/home/delfinoj/Tuscany/php5/php-5.2.0-bin
>> --with-apxs2 --enable-embed
>> make
>> make install
>>
>> --enable-embed allows linking with extension (and in particular the
>> Tuscany extension)
>> --with-apxs2 allows PHP5 to run as an Apache2 module (rather than CGI).
>>
>> I then built and linked the Tuscany extension to libphp5.so, like this:
>> libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
>>         -L$(top_builddir)/runtime/core/src -ltuscany_sca \
>>         -L${PHP_LIB} -lphp5
>>
>> INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \
>>            -I${TUSCANY_SDOCPP}/include \
>>            -I${PHP_INCLUDE} \
>>            -I${PHP_INCLUDE}/main \
>>            -I${PHP_INCLUDE}/Zend \
>>            -I${PHP_INCLUDE}/TSRM \
>>            -I${PHP_INCLUDE}/sapi/embed
>>
>>
>> The problem is that when I try to run Tuscany outside of Httpd (from the
>> command line) the PHP extension won't load, complaining about unresolved
>> references to Httpd symbols. Here's the log:
>>
>> 2555:3086005952     Library:
>>
>> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so 
>>
>> 2555:3086005952   SystemConfigurationException raised: Unable to load
>> library:
>>
>> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so: 
>>
>> /home/delfinoj/Tuscany/php5/php-5.2.0-bin/lib/libphp5.so: undefined
>> symbol: ap_rwrite
>> 2555:3086005952   SystemConfigurationException raised: Unable to load
>> library:
>>
>> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so: 
>>
>> /home/delfinoj/Tuscany/php5/php-5.2.0-bin/lib/libphp5.so: undefined
>> symbol: ap_rwrite
>> 2555:3086005952     << void tuscany::sca::util::Library::load()
>>
>> The unresolved symbol, ap_rwrite is in Httpd protocol.c, part of the
>> core Httpd server. Did you run into this issue with PHP SCA_SDO? Are
>> people using two different PHP libraries, one for use inside Httpd the
>> other for use outside?
>>
>> Thanks,
>>
>> -- 
>> Jean-Sebastien
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
>
> Hi Jean-Sebastien
>
> The truth is I'm not yet so I may not be much helkp to you. I'm 
> struggling
> to get C++/SCA to run again due to the start up crash I'm 
> investigating:-(
> I did have this working on windows before Christmas though but I didn't
> cross the bridge of running it in Apache. I ran it from the Axis 
> standalone
> server.
>
> Having said this I have PHP compile to integrate with Apache on both 
> of my
> linux boxes. One uses --enable-fastcgi and the other --with-apxs2. In 
> both
> of these cases I can run the CLI version of PHP i.e. I can run without
> Apache OK. Neither of these are compiled with embedding turned on 
> though so
> there may be some problem there.
>
> I have only compiled for embedding on windows to date where I have my 
> Apache
> integration set to --enable-fastcgi (nothing like a bit of variety). 
> In the
> windows case though the embedding API is compiled into a separate 
> library. I
> don't believe that is relevant though.
>
> So a couple of things to try.
>
> Can you try running PHP from the command line to check that it works 
> stand
> alone.
>  - you might need to do a make install-cli
> By way of experiment can you
>  - link with the Apache libraries that provide the missing function
>  - build PHP with cgi Apache integration and see if that works
>  - build PHP without Apache integration and see if that works.
>
> The only reference to problems with ap_rwite that I found with a quick
> Google search was from someone trying to integrate with Apache and they
> solved it with a clean rebuild so not very helpful.
>
> It may be that you have to suffer with building PHP for different
> environments.
>
> Simon
>

Simon,

I followed your advice and found a combination that works on Linux:

To build the PHP 5.2.0 runtime:
./configure --prefix=/home/delfinoj/Tuscany/php5/php-5.2.0-bin 
--with-apxs2 --enable-embed=static
make
make install

To build the PHP extension:
libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
    -L$(top_builddir)/runtime/core/src -ltuscany_sca \
    -L${PHP_LIB} -lphp5 -lresolv

--enable-embed=static allows the PHP extension shared lib to link with 
the PHP extension SAPI without creating a dependency on the Apache HTTPD 
runtime (which is in the server executable instead of a lib and 
therefore not available in a client).

-lresolv satisfies the PHP runtime dependency on the DNS resolver library.

With this configuration I can see the Tuscany runtime load and 
initialize the PHP extension.

-- 
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [PHP] Building the PHP runtime and SCA extension

Posted by Simon Laws <si...@googlemail.com>.
On 1/10/07, Jean-Sebastien Delfino <js...@apache.org> wrote:
>
> Simon Laws wrote:
> > On 1/9/07, Jean-Sebastien Delfino <js...@apache.org> wrote:
> >>
> >> Simon Laws wrote:
> >> > Ok, so after a rather lengthy (and relaxing) Christmas break I'm
> >> > starting to
> >> > work again on building up the PHP capability in the C++ SCA
> >> > implementation.
> >> > There was some work done before Christmas documented on our PHP SCA
> >> site
> >> > here [1]. There were some previous mail exchanges talking about the
> >> > problem
> >> > generally [2] and talking about the slight discontinuity between
> >> the way
> >> > that composition is represented in PHP SCA annotations compared to
> the
> >> > SCA
> >> > SCDL files in C++ SCA [3].
> >> >
> >> > The first thing I'm going to do is get the existing C++ PHP Extension
> >> > up and
> >> > running again and submit any changes that are required now that C++
> >> > SCA has
> >> > moved on and I'm on to a new version of PHP. I'll add some more
> detail
> >> to
> >> > the README about what to do. This note was just to get the ball
> >> rolling
> >> > again so I'm sure there will be lots more issues to discuss very
> >> shortly.
> >> >
> >> > Regards
> >> >
> >> > Simon
> >> >
> >> > [1] -
> >> > http://www.osoa.org/display/PHP/PHP+SCA+Extension+For+Tuscany+CPP+SCA
> >> > [2] -
> >> > http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg11572.html
> >> > [3] -
> >> > http://www.mail-archive.com/tuscany-dev%40ws.apache.org/msg11747.html
> >> >
> >>
> >> Simon,
> >>
> >> How are you building the PHP runtime to work both with the PHP SCA_SDO
> >> package at http://pecl.php.net/package/SCA_SDO and the Tuscany PHP
> >> extension?
> >>
> >> I built PHP 5.2.0 on my Linux box like this:
> >> ./configure --prefix=/home/delfinoj/Tuscany/php5/php-5.2.0-bin
> >> --with-apxs2 --enable-embed
> >> make
> >> make install
> >>
> >> --enable-embed allows linking with extension (and in particular the
> >> Tuscany extension)
> >> --with-apxs2 allows PHP5 to run as an Apache2 module (rather than CGI).
> >>
> >> I then built and linked the Tuscany extension to libphp5.so, like this:
> >> libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
> >>         -L$(top_builddir)/runtime/core/src -ltuscany_sca \
> >>         -L${PHP_LIB} -lphp5
> >>
> >> INCLUDES = -Imodel -I$(top_builddir)/runtime/core/src \
> >>            -I${TUSCANY_SDOCPP}/include \
> >>            -I${PHP_INCLUDE} \
> >>            -I${PHP_INCLUDE}/main \
> >>            -I${PHP_INCLUDE}/Zend \
> >>            -I${PHP_INCLUDE}/TSRM \
> >>            -I${PHP_INCLUDE}/sapi/embed
> >>
> >>
> >> The problem is that when I try to run Tuscany outside of Httpd (from
> the
> >> command line) the PHP extension won't load, complaining about
> unresolved
> >> references to Httpd symbols. Here's the log:
> >>
> >> 2555:3086005952     Library:
> >>
> >>
> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so
> >>
> >> 2555:3086005952   SystemConfigurationException raised: Unable to load
> >> library:
> >>
> >>
> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so:
> >>
> >> /home/delfinoj/Tuscany/php5/php-5.2.0-bin/lib/libphp5.so: undefined
> >> symbol: ap_rwrite
> >> 2555:3086005952   SystemConfigurationException raised: Unable to load
> >> library:
> >>
> >>
> /home/delfinoj/Tuscany/apache-deploy/cpp/sca/extensions/php/lib/libtuscany_sca_php.so:
> >>
> >> /home/delfinoj/Tuscany/php5/php-5.2.0-bin/lib/libphp5.so: undefined
> >> symbol: ap_rwrite
> >> 2555:3086005952     << void tuscany::sca::util::Library::load()
> >>
> >> The unresolved symbol, ap_rwrite is in Httpd protocol.c, part of the
> >> core Httpd server. Did you run into this issue with PHP SCA_SDO? Are
> >> people using two different PHP libraries, one for use inside Httpd the
> >> other for use outside?
> >>
> >> Thanks,
> >>
> >> --
> >> Jean-Sebastien
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
> >
> > Hi Jean-Sebastien
> >
> > The truth is I'm not yet so I may not be much helkp to you. I'm
> > struggling
> > to get C++/SCA to run again due to the start up crash I'm
> > investigating:-(
> > I did have this working on windows before Christmas though but I didn't
> > cross the bridge of running it in Apache. I ran it from the Axis
> > standalone
> > server.
> >
> > Having said this I have PHP compile to integrate with Apache on both
> > of my
> > linux boxes. One uses --enable-fastcgi and the other --with-apxs2. In
> > both
> > of these cases I can run the CLI version of PHP i.e. I can run without
> > Apache OK. Neither of these are compiled with embedding turned on
> > though so
> > there may be some problem there.
> >
> > I have only compiled for embedding on windows to date where I have my
> > Apache
> > integration set to --enable-fastcgi (nothing like a bit of variety).
> > In the
> > windows case though the embedding API is compiled into a separate
> > library. I
> > don't believe that is relevant though.
> >
> > So a couple of things to try.
> >
> > Can you try running PHP from the command line to check that it works
> > stand
> > alone.
> >  - you might need to do a make install-cli
> > By way of experiment can you
> >  - link with the Apache libraries that provide the missing function
> >  - build PHP with cgi Apache integration and see if that works
> >  - build PHP without Apache integration and see if that works.
> >
> > The only reference to problems with ap_rwite that I found with a quick
> > Google search was from someone trying to integrate with Apache and they
> > solved it with a clean rebuild so not very helpful.
> >
> > It may be that you have to suffer with building PHP for different
> > environments.
> >
> > Simon
> >
>
> Simon,
>
> I followed your advice and found a combination that works on Linux:
>
> To build the PHP 5.2.0 runtime:
> ./configure --prefix=/home/delfinoj/Tuscany/php5/php-5.2.0-bin
> --with-apxs2 --enable-embed=static
> make
> make install
>
> To build the PHP extension:
> libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
>     -L$(top_builddir)/runtime/core/src -ltuscany_sca \
>     -L${PHP_LIB} -lphp5 -lresolv
>
> --enable-embed=static allows the PHP extension shared lib to link with
> the PHP extension SAPI without creating a dependency on the Apache HTTPD
> runtime (which is in the server executable instead of a lib and
> therefore not available in a client).
>
> -lresolv satisfies the PHP runtime dependency on the DNS resolver library.
>
> With this configuration I can see the Tuscany runtime load and
> initialize the PHP extension.
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Nice one Sebastien. I'll put these notes in the readme for the extension.
We can't provide a makefile for PHP for obvious reasons but we can at least
record your experience.

Thanks

Simon