Building extension for Mac OS X

php.internals

Fredrik Olsson

20 years ago
I use the binary installation of PHP 5.0.4 from http://www.entropy.ch/software/macosx/php/ And a tiny test case trying to introduce the module hello, with the function hello_world() that simply returns a string. Actually I have just used copy and paste from this tutorial http://tinyurl.com/cahsj At first I ran php -r 'echo hello_world();' With "Fatal error: Call to undefined function: hello_world() in Command line code on line 1" as result. I checked into it and reallies that the default php was php 4, so I tried: /usr/local/php5/bin/php -r 'echo hello_world();' To be sure. This yields a better result :) PHP Warning: PHP Startup: : Unable to initialize module Module compiled with module API=20020429, debug=0, thread-safety=0 PHP compiled with module API=20041030, debug=0, thread-safety=0 These options need to match No problem, my guess is that #include "php.h" for some reason uses the php4 header file. How do I force phpize, ./configure, #include "php.h" etc, to use the installed php5 files (All residing under /usr/local/php5)? regards Fredrik Olsson

Rasmus Lerdorf

20 years ago
Fredrik Olsson wrote:
> I use the binary installation of PHP 5.0.4 from > http://www.entropy.ch/software/macosx/php/ > > And a tiny test case trying to introduce the module hello, with the > function hello_world() that simply returns a string. Actually I have > just used copy and paste from this tutorial http://tinyurl.com/cahsj > > At first I ran > php -r 'echo hello_world();' > With "Fatal error: Call to undefined function: hello_world() in Command > line code on line 1" as result. > I checked into it and reallies that the default php was php 4, so I tried: > > /usr/local/php5/bin/php -r 'echo hello_world();' > To be sure. > This yields a better result :) > PHP Warning: PHP Startup: : Unable to initialize module > Module compiled with module API=20020429, debug=0, thread-safety=0 > PHP compiled with module API=20041030, debug=0, thread-safety=0 > These options need to match > > No problem, my guess is that #include "php.h" for some reason uses the > php4 header file. How do I force phpize, ./configure, #include "php.h" > etc, to use the installed php5 files (All residing under /usr/local/php5)?
How about: /usr/local/php5/bin/phpize ? -Rasmus

Fredrik Olsson

20 years ago
Rasmus Lerdorf skrev:
> Fredrik Olsson wrote: >
<snip>
>>No problem, my guess is that #include "php.h" for some reason uses the >>php4 header file. How do I force phpize, ./configure, #include "php.h" >>etc, to use the installed php5 files (All residing under /usr/local/php5)? > > > How about: /usr/local/php5/bin/phpize ? >
Unfortunately not quite as easy :(.