# extension configure

- Thread: https://externals.io/message/22745
- Original archive: https://news-web.php.net/php.internals/22745
- Started by Richard Lynch on 2006-04-14T03:15:36+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22745 — Richard Lynch — 2006-04-14T03:15:36+00:00

URL: https://externals.io/message/22745#22745

I cannot seem to convince the "hello world" extension I am writing to
use the same PHP API version, debug, and ZTS mode as my PHP CLI.

../../sapi/cli/php -d extension_dir="." -r "dl('modules/perror.so');
echo hello_world();"

Warning: `dl()`: *8i(T7i(: Unable to initialize module
Module compiled with module API=20041030, debug=0, thread-safety=0
PHP    compiled with module API=20050922, debug=1, thread-safety=1
These options need to match
 in Command line code on line 1

API=20050922, debug=1, thread-safety=1 is what I would expect to see
for both, as the source tree I am using is from CVS -r PHP_5_1

I saw one post that 'dl' was deprecated and to just use extension= in
php.ini, so I've done it with -d extension=modules/perror.so and no
'dl and it's the same output.

I've been dinking with this for a couple hours, and the Google answers
are always "Use the same settings for ./configure for all
compilations"

Problem is, the configure lines I am using are the same, and I'm even
TELLING it to use the includedir/libdir I want.

From my extension directory:

-bash-2.05b$ cat ~/cvs/php-src/config.safe
#! /bin/sh
./configure --enable-debug --enable-maintainer-zts
--prefix=/www/acousticdemo.com/cvs/usr/local $@

[I set up a shell script so I wouldn't have to re-type it each time.]

-bash-2.05b$ cat config.nice
#! /bin/sh
#
# Created by configure

'./configure' \
'--enable-debug' \
'--enable-maintainer-zts' \
'--enable-perror' \
'--prefix=/www/acousticdemo.com/cvs/usr/local/' \
'--includedir=/www/acousticdemo.com/cvs/usr/local/' \
'--libdir=/www/acousticdemo.com/cvs/usr/local/' \
"$@"
-bash-2.05b$

So that's what I ASKED the extension to compile as...


Okay, so I added --includedir and --libdir in an attempt for FORCE the
Module to look where I want it to.  But it failed the same way without
them.

Yet, it persists in using what I believe are the headers from my
webhost installation in /usr/local/bin, which would be PHP 5.0.4

Is there any other magic incantation I can use to FORCE the extension
configure script to ignore /usr/local and use MY ~/cvs/usr/local

I feel like I've done everything "right" and yet it ignores what I ask
it to do in favor of /usr/local, which is what I expressly do not
want.

I have had to comment out a couple "exit" lines in
../../usr/local/bin/phpize in the autoconf stuff, because I set
$PHP_AUTOCONF and $PHP_AUTOHEADER for /usr/local/bin/autoconf213
FreeBSD style, and those tests seem bogus, but I really doubt that is
the cause of this particular problem... Is it?

How do you guys handle having multiple installs/versions.

Surely you guys don't wipe out your base /usr/local every time... Do you?

Maybe this matters?

FreeBSD o11.hostbaby.com 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Sat Jan
15 06:47:43 PST 2005

God I hope I'm not doing something colossally stupid.  Again.

-- 
Like Music?
http://l-i-e.com/artists.htm

---

## #22746 — John Coggeshall — 2006-04-14T03:28:01+00:00

URL: https://externals.io/message/22745#22746 · In reply to: #22745

Richard:

I haven't even looked at the code for phpize yet, but this is just a
hunch -- what is the output of php-config? Wouldn't surprise me to find
out that's how it gets the information, nor that it is the reason you're
build isn't working.

John


> I cannot seem to convince the "hello world" extension I am writing to
> use the same PHP API version, debug, and ZTS mode as my PHP CLI.
> 
> ../../sapi/cli/php -d extension_dir="." -r "dl('modules/perror.so');
> echo hello_world();"
> 
> Warning: `dl()`: *8i(T7i(: Unable to initialize module
> Module compiled with module API=20041030, debug=0, thread-safety=0
> PHP    compiled with module API=20050922, debug=1, thread-safety=1
> These options need to match
>  in Command line code on line 1
> 
> API=20050922, debug=1, thread-safety=1 is what I would expect to see
> for both, as the source tree I am using is from CVS -r PHP_5_1
> 
> I saw one post that 'dl' was deprecated and to just use extension= in
> php.ini, so I've done it with -d extension=modules/perror.so and no
> 'dl and it's the same output.
> 
> I've been dinking with this for a couple hours, and the Google answers
> are always "Use the same settings for ./configure for all
> compilations"
> 
> Problem is, the configure lines I am using are the same, and I'm even
> TELLING it to use the includedir/libdir I want.
> 
> From my extension directory:
> 
> -bash-2.05b$ cat ~/cvs/php-src/config.safe
> #! /bin/sh
> ./configure --enable-debug --enable-maintainer-zts
> --prefix=/www/acousticdemo.com/cvs/usr/local $@
> 
> [I set up a shell script so I wouldn't have to re-type it each time.]
> 
> -bash-2.05b$ cat config.nice
> #! /bin/sh
> #
> # Created by configure
> 
> './configure' \
> '--enable-debug' \
> '--enable-maintainer-zts' \
> '--enable-perror' \
> '--prefix=/www/acousticdemo.com/cvs/usr/local/' \
> '--includedir=/www/acousticdemo.com/cvs/usr/local/' \
> '--libdir=/www/acousticdemo.com/cvs/usr/local/' \
> "$@"
> -bash-2.05b$
> 
> So that's what I ASKED the extension to compile as...
> 
> 
> Okay, so I added --includedir and --libdir in an attempt for FORCE the
> Module to look where I want it to.  But it failed the same way without
> them.
> 
> Yet, it persists in using what I believe are the headers from my
> webhost installation in /usr/local/bin, which would be PHP 5.0.4
> 
> Is there any other magic incantation I can use to FORCE the extension
> configure script to ignore /usr/local and use MY ~/cvs/usr/local
> 
> I feel like I've done everything "right" and yet it ignores what I ask
> it to do in favor of /usr/local, which is what I expressly do not
> want.
> 
> I have had to comment out a couple "exit" lines in
> ../../usr/local/bin/phpize in the autoconf stuff, because I set
> $PHP_AUTOCONF and $PHP_AUTOHEADER for /usr/local/bin/autoconf213
> FreeBSD style, and those tests seem bogus, but I really doubt that is
> the cause of this particular problem... Is it?
> 
> How do you guys handle having multiple installs/versions.
> 
> Surely you guys don't wipe out your base /usr/local every time... Do you?
> 
> Maybe this matters?
> 
> FreeBSD o11.hostbaby.com 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Sat Jan
> 15 06:47:43 PST 2005
> 
> God I hope I'm not doing something colossally stupid.  Again.
> 
> -- 
> Like Music?
> http://l-i-e.com/artists.htm

---

## #22750 — Richard Lynch — 2006-04-14T04:35:24+00:00

URL: https://externals.io/message/22745#22750 · In reply to: #22746

> I haven't even looked at the code for phpize yet, but this is just a
> hunch -- what is the output of php-config? Wouldn't surprise me to
> find
> out that's how it gets the information, nor that it is the reason
> you're
> build isn't working.

Hey John;

There's no "php-config" in the "phpize"

It's created by buildconf; ./configure and has the prefix hard-coded
into it:

# Variable declaration
prefix='/www/acousticdemo.com/cvs/usr/local'
exec_prefix="`eval echo ${prefix}`"
phpdir="`eval echo ${exec_prefix}/lib/php`/build"
includedir="`eval echo ${prefix}/include`/php"
builddir="`pwd`"


I even added an:
echo "includedir: $includedir"
right before the bit that actually looks up the versions, and it's my
dir...

And, sure enough, in the $includedir/php/main/php.h file, there's that
20041225...

I'm so confused!!!

In my CVS tree:
-bash-2.05b$ ../usr/local/bin/php-config --prefix
/www/acousticdemo.com/cvs/usr/local
-bash-2.05b$ ../usr/local/bin/php-config --includes
-I/www/acousticdemo.com/cvs/usr/local/include/php
-I/www/acousticdemo.com/cvs/usr/local/include/php/main
-I/www/acousticdemo.com/cvs/usr/local/include/php/TSRM
-I/www/acousticdemo.com/cvs/usr/local/include/php/Zend
-I/www/acousticdemo.com/cvs/usr/local/include/php/ext
-bash-2.05b$ ../usr/local/bin/php-config --ldflags
-L/usr/local/lib
-bash-2.05b$ ../usr/local/bin/php-config --libs
-lcrypt -lcrypt -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv
-lm -lxml2 -lz -liconv -lm -lcrypt -lxml2 -lz -liconv -lm -lxml2 -lz
-liconv -lm -lxml2 -lz -liconv -lm -lcrypt
-bash-2.05b$ ../usr/local/bin/php-config --extension-dir
/www/acousticdemo.com/cvs/usr/local/lib/php/extensions/debug-zts-20050922
-bash-2.05b$ ../usr/local/bin/php-config --version
5.1.3RC3
-bash-2.05b$


Using the "stock" webhost:
-bash-2.05b$ php-config --prefix
/usr/local
-bash-2.05b$ php-config --includes
-I/usr/local/include/php -I/usr/local/include/php/main
-I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend
-bash-2.05b$ php-config --ldflags
-L/usr/local/lib
-bash-2.05b$ php-config --libs
-lcrypt -lcrypt -lm -lxml2 -lz -liconv -lm -lcrypt -lcrypt
-bash-2.05b$ php-config --extension-dir
/usr/local/lib/php/20041030
-bash-2.05b$ php-config --version
5.0.4
-bash-2.05b$


So how did I get the 20041225 php.h into my CVS tree? :-(

I mean, that doesn't even match anything at all...

It WOULD match, right?  --extension-dir and php.h API version?
[Though I'm sure somebody could make them not match if they wanted to
confuse themselves even more than I already have...]

And, like, how come ldflags didn't change?  Or is that were the OS
libs are, and it shouldn't change?

I must have been in some OTHER cvs tree and been typing madly away
configuring and compiling it into the cvs tree I thought I was in? 
Right?

Sheesh!

That makes me feel pretty stupid.

But I'm pretty sure that I did my latest ./configure in the right
directory...  Guess not, though, from the evidence, hunh?

Too many PHP versions floating around here...

I gotta have the webhost's version.
I've got a snap from last night to squash a bug.
Plus one from the night before that squashed another bug.
Plus another one that squashed a similar bug that I hoped would be mine.
And I thought it would make sense to use -r PHP_5_1 to play with a new
extension.  I'll add enough instability of my own :-)

Is there a chart somewhere that matches up things like:
20041020 5.0.4
20041225 ?.?.?
20050922 5.1.3RC3

Idiots like me need could really use that. :-)

These date-version number things *DO* stay consistent across a
source/build, right?...

I mean, 20041020 is always 5.0.4, right???
Where is that bit explained?...

Anybody got a handy .profile prompt setter thingie to tell me which
CVS dir I'm in, without making the prompt ridiculously long? :-)

Thanks all.  I knew it had to be a stupid mistake SOMEWHERE.

-- 
Like Music?
http://l-i-e.com/artists.htm

---

## #22752 — Michael Wallner — 2006-04-14T06:57:42+00:00

URL: https://externals.io/message/22745#22752 · In reply to: #22745

Richard Lynch wrote:

> From my extension directory:
> 
> -bash-2.05b$ cat ~/cvs/php-src/config.safe
> #! /bin/sh
> ./configure --enable-debug --enable-maintainer-zts
> --prefix=/www/acousticdemo.com/cvs/usr/local $@

Point configure to "your local" php-config:
./configure ... --with-php-config=/usr/local/bin/php-config

Regards,
-- 
Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz

---

## #22753 — Michael Wallner — 2006-04-14T07:00:09+00:00

URL: https://externals.io/message/22745#22753 · In reply to: #22752

Michael Wallner wrote:
> Richard Lynch wrote:
> 
> > […]
> 
> 
> Point configure to "your local" php-config:
> ./configure ... --with-php-config=/usr/local/bin/php-config

Oh, I seemingly quoted the wrong part of your message.
I--of course--meant the extensions configure.

Regards,
-- 
Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz
