Author Topic: PHP build chokes  (Read 5600 times)

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
PHP build chokes
« on: 24 January 2010, 14:33 »
Of course OSX has php built-in.  But of course it isn't built with postgresql support, which I need for a project.  So I'm trying to build my own version and failing.  Here are some of the lurid details.

PHP version - 5.3.1

Configure:
Code: [Select]
./configure --prefix=/usr/local/php5 --with-libxml-dir=/opt/local
--enable-exif --with-openssl=/opt/local --with-zlib --with-zlib-dir=/opt/local
--with-bz2=/opt/local --with-curl=/opt/local --with-jpeg-dir=/opt/local
--with-png-dir=/opt/local --with-freetype-dir=/opt/local --with-openssl-dir=/opt/local
--with-gettext=/opt/local --with-mysql=/usr/local/mysql --with-pgsql=/Library/PostgreSQL/8.4/bin
--enable-soap --with-xsl=/opt/local --enable-shared --enable-static --with-iconv-dir=/usr/local/libiconv
Most of the stuff needed was installed with MacPorts, which keeps everything in /opt/local.  Originally, libiconv was there also, but I thought it might be the problem, so I built my own version from source.

The relevant part of the make process:
Code: [Select]
Undefined symbols:
  "_iconv_close", referenced from:
      _php_iconv_string in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strlen in iconv.o
      __php_iconv_strpos in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_substr in iconv.o
      _php_iconv_stream_filter_dtor in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
  "_iconv_open", referenced from:
      _php_iconv_string in iconv.o
      __php_iconv_strlen in iconv.o
      __php_iconv_strpos in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_factory_create in iconv.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

Supposedly, I can build --without-iconv.  Would that be wise?  Any other suggestions?

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #1 on: 25 January 2010, 01:08 »
Thanks for all your help, guys.  As it turns out, this is a known bug in the libiconv included in Leopard.  The workaround is to use --with-iconv=shared,[dir] instead of --with-iconv-dir=[dir].  This has something to do with bypassing the search path and forcing the linker to skip over the built-in libiconv in favor of the aftermarket version.  I was able to build successfully using the libiconv from MacPorts, so I can go ahead and remove that GNU source version I built.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #2 on: 25 January 2010, 02:37 »
Oops, I forgot something:
--with-apxs2=/usr/sbin/apxs

Yes, I'm talking to myself.  But maybe this will help someone, eventually.

Aloone_Jonez

  • Administrator
  • Member
  • ***
  • Posts: 4,090
  • Kudos: 954
Re: PHP build chokes
« Reply #3 on: 25 January 2010, 03:38 »
Lol, I did read this thread.

All I have to say is that I have no clue as I don't know any PHP but I thought I'd respond in the hope it'll make you feel better as it is frustrating when you think no one's listening. :)
This is not a Windows help forum, however please do feel free to sign up and agree or disagree with our views on Microsoft.

Oh and FUCKMicrosoft! :fu:

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: PHP build chokes
« Reply #4 on: 25 January 2010, 08:09 »
How many mac os x software compiling people come on this forum every day to respond to threads? :s
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #5 on: 25 January 2010, 11:16 »
Adding the apxs line to the configure changed things immensely.  Now all sorts of things are broken, including openssl and libxml2.  For starters, the Apple versions are either too far behind or corrupted in some way.  To complicate matters, the PHP makefiles will not search for the libraries you tell it to use if those libraries are found in the system folders.

An excellent discussion of why it does this, and what can be done to fix it:
http://blog.yimingliu.com/2009/02/24/missing-library-symbols-while-compiling-php-528/

I'm doing it the fun way, by renaming the system libraries temporarily, which will force the makefile to find the libraries in the locations I have specified.  Just hope I remember to change them back afterwards.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #6 on: 26 January 2010, 00:12 »
Finally got this thing working.  Ended up having to modify the makefile.

Proof:


worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #7 on: 31 January 2010, 03:52 »
Okay, the PHP issue is past.  But then I was modifying the httpd-vhosts.conf file, and suddenly Apache shit all over the rug and started complaining that it couldn't find the PHP module.  So I had to start over again.  This time, I found a method that allowed me to install Apache 2.2.14 right over top of the built-in 2.0.x version.  Then I built the PHP, and verified that it was working.  But then when I went to check my phpinfo() in the browser (Firefox), it clearly wasn't working at all.  After some testing, I found the issue, and started over AGAIN.  The browser, though, stayed open, because I was working on something else (my online job).  After finally rebuilding Apache and PHP, things seemed okay, and the server restarted without issue, and the virtual hosts were working just fine, but phpinfo() still wasn't working.  Man, I wracked my brain and kicked my computer and studied for hours about mime types and verified ten times over that everything was installed right.  Then on a whim, I decided to check it in Safari.  Worked right away, no issues.  After restarting Firefox, it worked right as well.

I guess this is normal behavior - the content of the webroot folder had not changed even by a byte, so a refresh had no effect.  For future reference, how can you force the browser to renegotiate with the host so that server function changes have an effect?  Surely it's not necessary to reboot the browser everytime I make development changes?

davidnix71

  • Member
  • **
  • Posts: 760
  • Kudos: 501
Re: PHP build chokes
« Reply #8 on: 31 January 2010, 05:17 »
Firefox ram/hd caches a lot of things. I force FF to delete everything but my passwords and bookmarks every time it quits, just to be sure.

I also can't get torrents to run from localhost (a desktop file) in Opera 10, either, but that worked in Opera 9. All it will do is try to resave the existing file.
« Last Edit: 31 January 2010, 05:22 by davidnix71 »

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: PHP build chokes
« Reply #9 on: 1 February 2010, 14:44 »
You can bypass the cache with Ctrl+F5 (IE: Shift+F5, if I'm correct) or Shift+Ctrl+R.
Firefoxes help system (press f1) is pretty damn legendary

edit: also you can hold shift while clicking the refresh button
« Last Edit: 1 February 2010, 14:48 by piratePenguin »
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

worker201

  • Global Moderator
  • Member
  • ***
  • Posts: 2,810
  • Kudos: 703
    • http://www.triple-bypass.net
Re: PHP build chokes
« Reply #10 on: 4 April 2010, 21:17 »
Fuck me skating.  After all this work to get PHP5 and Apache 2.2 and PostgreSQL running, the whole system was laid waste by installing a Leopard security update.  Now I'm back to Mac default Apache and PHP, and no PostgreSQL support.  Goddammit.