My thanks to the contributors and for the resource documentation that:
a) has confirmed that writing extensions without recompiling PHP is possible
b) have provided sample code that requires recompilation of PHP
As a Linux newbie but experienced Windows programmer I do not have
the arcane knowledge to infer from the recompile-PHP sample how to
modify it to generate a must-recompile-php sample to a standalone extension.
I haven't used make in twenty years, and autoconf is alien to me.
I am getting to grips with .so (shared object) libraries in Unix, but I am in the
dark and my effort would be greatly expedited by someone knowledgeable in the art.
I therefore re-interate my request for a complete walkthrough for writing
an extension that does not require recompilation of php but can be treated
as a simple external standalone project, for later inclusion into the Apache/PHP
module by dynamic linking.
I have installed and am running Suse 9.3, with Apache 2.0 and Php 5, all
from the Suse distribution. I have downloaded the source for Php 5.1.1, but while
I have compiled such (in the course of the build-extension-with-recompile) I do not
wish to rely on having to recompile PHP every time I wish to build an extension.
I have not therefore attempted to replace the distribution-Php with the compiled-Php.
At this point, my need for such assistance is critical, as a client project is stalled
for lack of it.
I appreciate that money is a dirty word in Linux, but time and money are being wasted
for want of these answers, so that I would be more than happy to provide £100 for the
first proven and effective replies in each of these categories (all of which may happily
be 'scooped' by or paid to a single person):
i) a walkthrough of the exact steps + sample code to write an extension without
requiring re-compilation of Php and without access to Php source code
ii) as above but with access to Php source code
iii) as above (either i or ii) but with instructions to allow the project to be initiated
and compiled within the KDE development environment
Resulting object (presumably .so) to be accessible in a distribution release of Apache/Php
with only minor modification of a client's Apache/Php config settings.
Andrew Mather wrote:
i) a walkthrough of the exact steps + sample code to write an extension without
requiring re-compilation of Php and without access to Php source codeii) as above but with access to Php source code
You're clearly missing the -devel RPM that installs the necessary header
files to allow you to build extensions outside of a source tree. That
devel rpm will install the phpize and php-config executables, and a set
of headers under the appropriate destination for your distro (I'm not a
SuSE user, but I would expect them to be either under /usr/include/php
or /usr/local/include/php). If you don't have these then you need to
get the RPM that provides them (php-devel or something along those
lines) before you can move forward. Look at practically any extension
in PECL and read it's INSTALL instructions. For instance, look at APC
and read it's INSTALL file. Again, without the -devel RPM that provides
your necessary headers you will be up th creek.
iii) as above (either i or ii) but with instructions to allow the project to be initiated
and compiled within the KDE development environment
That shouldn't make any difference.
George
Andrew Mather wrote:
i) a walkthrough of the exact steps + sample code to write an extension without
requiring re-compilation of Php and without access to Php source code
maybe its time for a shameless plug one more time:
http://pear.php.net/package/CodeGen_PECL/docs
this approach will shield you from autoconf/make details as
much as possible, it will also generate windows VS 6.0 .dsp
project files, too
ii) as above but with access to Php source code
its not mentioned in the above docs, but compiling the generated
extension code staticly into PHP just requires these simple steps:
-
place the generated code directory into PHPs ext/ directory
-
run buildconf (in the top level src directory)
-
if you've already built php from this source tree before do
config.nice ...any-options-specific-to-your-extension
else extract the configure string for the current php installation
from "php -i" output, re-use this configure line and add your
extensions options to it -
make
-
optional: make test
-
make install (may require sudo)
iii) as above (either i or ii) but with instructions to allow the project to be initiated
and compiled within the KDE development environment
i don't know / use Kdevelop, but i'm pretty sure that it allows
to integrate standard unix projects based on configure/make ...
Resulting object (presumably .so) to be accessible in a distribution release of Apache/Php
with only minor modification of a client's Apache/Php config settings.
using CodeGen_PECL you'll get a full self contained extension
project, including a package.xml file suitable for automatic
installation using the pear installer
--
Hartmut Holzgraefe, Senior Support Engineer .
MySQL AB, www.mysql.com
Ouf, Hartmut, does it make 'the new win32 build system' config files too?
/me hasn't tried, just wants to know...
----- Original Message -----
From: "Hartmut Holzgraefe" hartmut@php.net
To: "Andrew Mather" an.dromeda@btconnect.com
Cc: internals@lists.php.net
Sent: Friday, February 10, 2006 8:01 PM
Subject: Re: [PHP-DEV] Dead C Scrolls - Missing Code for Writing New
Extensionswithout recompiling PHP
Andrew Mather wrote:
i) a walkthrough of the exact steps + sample code to write an
extension without
requiring re-compilation of Php and without access to Php source
codemaybe its time for a shameless plug one more time:
http://pear.php.net/package/CodeGen_PECL/docs
this approach will shield you from autoconf/make details as
much as possible, it will also generate windows VS 6.0 .dsp
project files, tooii) as above but with access to Php source code
its not mentioned in the above docs, but compiling the generated
extension code staticly into PHP just requires these simple steps:
place the generated code directory into PHPs ext/ directory
run buildconf (in the top level src directory)
if you've already built php from this source tree before do
config.nice ...any-options-specific-to-your-extension
else extract the configure string for the current php installation
from "php -i" output, re-use this configure line and add your
extensions options to itmake
optional: make test
make install (may require sudo)
iii) as above (either i or ii) but with instructions to allow the
project to be initiated
and compiled within the KDE development environmenti don't know / use Kdevelop, but i'm pretty sure that it allows
to integrate standard unix projects based on configure/make ...Resulting object (presumably .so) to be accessible in a distribution
release of Apache/Php
with only minor modification of a client's Apache/Php config settings.using CodeGen_PECL you'll get a full self contained extension
project, including a package.xml file suitable for automatic
installation using the pear installer--
Hartmut Holzgraefe, Senior Support Engineer .
MySQL AB, www.mysql.com--
__________ NOD32 1.1380 (20060125) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com