Installing the Geoip PECL package for Zend Server on OSX

Today I needed to get a client application up and running on my local system. This application uses the Geoip PECL package, so I needed to get this up and running. This turned out to be slightly more difficult than just a PECL install, as you're missing some libraries by default, so here is my log of things to do to get it up and running.

Note: I am using Zend Server Enterprise on my local machine. While I don't think the steps will be different for Zend Server CE, you might want to check to make sure.

Starting out

When you try to just install the Geoip package using pecl install, the installation will fail. Initially, the errors might seem a bit cryptic, but if you look back a bit in the log of what the installation did, you'll notice a couple of things. First thing is a missing 're2c'.

re2c

I simply downloaded the source package and compiled re2c using the simple commands:

./configure
make
sudo make install

This worked for me. Next time I tried pecl install geoip, the log shows it found re2c. BAM!

Geoip

The next error was slightly more cryptic:

checking for geoip files in default path... not found
configure: error: Please reinstall the geoip distribution

After some searching a bit of help from my current colleagues, I found out this refers to the MaxMind GeoIP API package. I downloaded the source for that, checked the README.OSX and found a nice shell script which will do most of the work for you. So I issued:

sh README.OSX
sudo make install

I got no errors at all during the installation, so I assumed the installation went fine. And indeed, running pecl install geoip now worked!

Enabling the extension

Last step left now is to enable the extension. Lazy as I am, I used the Zend Server control panel. I went to the Server Setup tab, to the extensions option. The listing now included the geoip extension. I clicked the "turn on" link, then "restart PHP" (whoever thought of the term "restart PHP" should seriously consider another carreer ;) ). Unfortunately, "The system could not load this extension".

Building for the right architecture

Trying to Google for this error, I didn't really get much further. The error is too generic to really find any useful information. Asking around on Twitter, I luckily got some useful information that I could use in the search. Alvaro mentioned the files might not be built for the right architecture. Being on OSX Lion, I would assume everything was built for 64bit. And indeed, I could confirm this with:

file /usr/local/zend/lib/php_extensions/geoip.so 
/usr/local/zend/lib/php_extensions/geoip.so: Mach-O 64-bit bundle x86_64

Next step was to check whether Zend Server perhaps was not 64bit, and indeed, this was the case!

file /usr/local/zend/bin/php
/usr/local/zend/bin/php: Mach-O executable i386

So apparently, I had to build the geoip extension for i386 instead! Again, I had to ask around a bit to do this, and Jeroen hinted me to the CFLAGS. Of course, I had to use this both on the GeoIP API and on the PECL extension. So, I had to reissue the commands. Note: just rebuilding the Maxmind GeoIP API didn't do the trick for me. I had to remove the directory and unpack the tgz again for this to work.

Before building the MaxMind GeoIP API, I opened the README.OSX file that contained the installscript. I updated it to be as follows:

export GEOIP_ARCH='-arch i386'
export MACOSX_DEPLOYMENT_TARGET=10.7
export LDFLAGS=$GEOIP_ARCH
export CFLAGS="-g -mmacosx-version-min=10.7 -isysroot /Developer/SDKs/MacOSX10.7.sdk $GEOIP_ARCH"
./configure --disable-dependency-tracking
perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool
make

Not that I didn't just change the GEOIP_ARCH, but I also updated the version numbers in the SDK line. Then I ran the script and ran make install.

Reinstalling the PECL extension

Then I uninstalled the PECL geoip package to remove the old version:

sudo pecl uninstall geoip

After doing that, I reinstalled the package again, but specifying i386:

sudo CFLAGS="-arch i386" bin/pecl install geoip

I then restarted Apache, refreshed the extensions page in the Zend Server control panel, and lo and behold: It said the extension was loaded and ready to use. Then I ran the script I needed to work on, and it didn't error out anymore on the geoip functions missing. It worked!

One thing to note

In the above, for all PECL commands I did, I used the PECL binary in /usr/local/zend/bin/pecl. It is important to use this version if you're using Zend Server, because it is the same build as the other stuff, with the right configuration. I don't know if it would work with another PECL installation, but better be safe, right?


Add comment

Comments

gravatar laundry chute: Although a chute's design depends on the house, Tom recommends an elevated door to prevent kids from accidentally falling down the chute. State building codes might regulate size, placement and design, and sometimes require a trapdoor to prevent fires from traveling up a chute.
January 18, 2012
gravatar online dating sites: great post , I defiantly see the point here even thought some people may not agree.
January 22, 2012
gravatar Government Auctions: Awesome information on this site, I'm bookmarking it and sharing it on facebook!

Thanks for all of the help!
January 25, 2012
gravatar Testking 70-642: Refreshed the extensions attendant in the Zend Computer discipline window, and lo and see: It said the dissemination was full and prompt to use.
January 25, 2012
gravatar essay writing help online: I think more people need to read blogs like this.

February 2, 2012
gravatar Commercial Cleaning Sydney: I am surprised with the writing. I have read the publish and no cost really is very helpful even in a non IT career. I am an accountants grad student but I am operating as a Customer Service Rep and as well during my time, I am currently operating as a data entry position. I just started and I experienced operating in my time. :)
February 7, 2012
gravatar used machinery dealers: The thoughts are very well set up out and it was calming to research. I was able to find information that I was looking for. I just preferred to leave a thoughts as a little of admiration. Thanks for providing this on the Net. :D :P
February 7, 2012
gravatar angina symptoms: I think more people need to read blogs like this.
February 8, 2012
gravatar Custom Return Essays: Easily post is really more on this commendable. I agree with your conclusions and eagerly look forward to your future updates. Saying thank you will not only be sufficient to c great lucidity in your writing. I will instantly capture your RSS feed to stay abreast of updates. strong work and much success in your business!

February 8, 2012
gravatar Buy Dissertataion Online: Nice post. I be taught one thing tougher on different blogs everyday. It will at all times be stimulating to learn content from different writers and follow somewhat one thing from their store. I?d want to make use of some with the content material on my blog whether or not you don?t mind. Naturally I?ll give you a hyperlink on your net blog.

February 8, 2012
gravatar Need To Buy Essay Online: This is very surprising description can be very accommodating to students. An excellent site! I really like a couple of articles that were written, you put a really useful information. Keep it up. Keep blogging. Great stuff, worth reading. Thanks for sharing!

February 8, 2012
gravatar Logo Design Contests: The author has written an excellent article. You made your point and not much to discuss. It’s like this universal truth that you can not argue with the truth is not universal, everything has its exception. Thanks for this information.

February 8, 2012
gravatar good kisser: I am surprised with the writing. I have read the publish and no cost really is very helpful even in a non IT career. I am an accountants grad student but I am operating as a Customer Service Rep and as well during my time, I am currently operating as a data entry position. I just started and I experienced operating in my time.
February 7, 2012
February 9, 2012
gravatar air jordan shoes: I like to spend my free time by scaning various internet recourses. Today I came across your blog and I located it is as one of the best free resources available! Well done! Keep on this quality! 8-O
February 9, 2012
gravatar Canada Goose Jacket: Thank you for the reveal of your article, also it was seriously wonderful, extremely wonderful

February 10, 2012
gravatar Maize Milling: I love comments on my blogs. I feel like it validates some of my writing, and if nothing else, it at least shows me people are reading it.
February 10, 2012
gravatar SEO Lancaster PA: I have to say, I dont know if its the clashing colours or the bad grammar, but this blog is hideous! I mean,I dont want to sound like a know-it-all or anything, but could you have possibly put a little bit more effort into this subject. Its really interesting, but you dont represent it well at all, man.
February 10, 2012
gravatar car insurance companies: Dans les Vosges, dix-huit païennes mortes-vivantes réagissent à la goutte d'eau bigarrée sans se coiffer. Etienne Mougeotte réclame de s'abonner à plusieurs régimes fermés.
February 12, 2012
gravatar car insurance comparison: L'arbitre du match "Antoine de Caunes contre Florent Pagny" se consacrait aux compagnies avec beaucoup de rigueur.
February 12, 2012
gravatar car insurance comparisons: Elle comptera atterrir sur ce marécage sans être à la limite du cercle polaire arctique...

February 12, 2012
gravatar vehicle insurance: Onze taulardes aux longs cils parleront de mélanger une notion avec un poulet. L'éminence déteste descendre à la piscine jusqu'au bout.
February 12, 2012
gravatar allopurinol side effects: Neat site! A design like this would surely make my website stand out. Please tell me the places you got your theme. Many thanks!
February 13, 2012
gravatar free cell phone spy software: This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post.
February 13, 2012
gravatar Assignment Help: I hope you can continue this type of hard work to this site in future also..
February 15, 2012
gravatar Coursework Help: Because this blog is really very informative and it helps me lot.

February 15, 2012
gravatar Custom Essay Writing Service: I am once again feeling happy and proud to say that this is my favorite web site.

February 15, 2012
gravatar Buy Essays Online: Nicely explained. It's indeed an art to stop new visitors with your attractive writing style. Truly impressive and nice information. Thanks for sharing.

February 15, 2012
gravatar Wheat Milling Project: With regards to fitness I just get off and walk up nasty hills. Eventually the fitness will build up.
February 15, 2012
gravatar nokia mobiles: It’s actually a great and helpful piece of info. I’m happy that you shared this helpful info with us. Please stay us up to date like this.
February 15, 2012
gravatar actos side effects: I'm impressed. You're truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. I'm saving this for future use...
February 16, 2012
gravatar discount coach bags: It truly is more effective to give acceptance within the professionals with appropriate relationship

February 16, 2012
gravatar house painters san diego: I am really happy that I stumbled across this in my search for something relating to this issue. For most people, feelings of anxiety, sadness, grief and anger are healthy and appropriate. But some people may have more profound and debilitating reactions to the war.
February 16, 2012
gravatar house painters san diego: Refreshed the extensions attendant in the Zend Computer discipline window, and lo and see: It said the dissemination was full and prompt to use.
February 16, 2012
gravatar jonathan lipoescultura sin cirugia: great post this tutorial is you were looking for, arrives through search engines to find this great site, thank you
February 17, 2012
gravatar Garden Umbrellas: I found your blog site on google and examine a few of your early posts. Proceed to maintain up the excellent operate.
February 17, 2012
gravatar Garden Umbrellas: Admiring the persistence you put into your site and detailed information you provide.
February 17, 2012
gravatar UK Dependant Visas: I sense like it validates some of my writing, and if nothing else, it at least shows me flight are definition it.
February 22, 2012
gravatar immigration expert canada: The composer has written an excellent article. You made your pip and not much to discuss. It’s like this universal reality that you can not argue with the fact is not universal, formation has its exception.
February 22, 2012
gravatar personal injury claims: When you try to just install the Geoip package using pecl install, the installation will fail,uninstalled the PECL geoip package to remove the old version,it would work with another PECL installation,follow the procedure.
February 22, 2012

Php5_zce_logo

Upcoming events

I will be speaking 23-02-2012: Zend Webinar: Git for Subversion Users
I will be speaking 28-02-2012: PHPBenelux Meeting
I will be speaking 18-04-2012: 4developers

Tags

1337 2008 2010 2011 4developers access modifiers accessibility AdaLovelaceDay09 advent agavi agile alfred amsterdam apache api apple article articles atk atkMetaNode audioscrobbler automation azure backwards compatibility barcelona barcodes bash bbc bbq beatstad belgium best practices bittorrent blogging blogs boards of canada book books bughuntday bundle caching cake cal evans calendar career cat cerf certificate cfp clear cms cologne common sense communities community components conference conferences contest continuous integration contribute contribution crisis css custom d-day datetime DbFinderPlugin decorator decorators deployment devdays development directoryindex docblox doctrine documentation download dpc dpc09 dpc10 dpc11 DPC2008 dreamhost drupal dv7 eclipse ed editors efficiency enterprise errors event events expertise ezcomponents facebook finland flickr fork framework frameworks freelance freeze frontend fun game games geoip germany getting real git github gnome-do google google calendar googletalk graceful degradation hack hackers hidden gem hiphop howto hp HR html http i386 ibuildings icann ide ideasofmarch idm imovie indy ingewikkeld integration international php conference internet interview ipad IPC ipc ipc08 ipc10 ipc11se iterm2 javascript jenkins jenkins-php job job openings jobeet john peel joomla joomladays kiva kubuntu launcher launchy left on the web libraries library lighttpd lime linktuesday linux live london loudblog m2ts mac magazines malware mambo marjolein mediterra meeting meme meta methodology micro-financing microframework microsoft migration movie music mysql namespace namespaces netbeans netherlands newsfire nllgg nos odmarco open source opinion ORM osx paradiso paris partnership pavilion pear pecl performance personal pfc10 pfc11 pfcongres pfcongrez pfz photo php php5.3 phpabstract phpazure phpBB phpbb phpbelgium phpbenelux phpbnl10 phpday phpdoc phpdocumentor phpgg phpitalia phpnw phpnw08 phpnw11 phpstorm phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations private projects protected prototype PSR-0 public python qa qr codes re2c recruiting refactoring review rewrite ruby on rails san francisco schedule scifi script security sensio seven things sfdaycgn sflive2011 shell scripting silex simplexml slides smfony software sogeti solar sound speakers spl ssh standard standards star trek static steer strings stylesheets subversion symfony symfony live Symfony2 symfonycamp symfonyday symfonylive symfonyUnderControlPlugin talk talks techademy technology techportal tek09 telecommuting terratec terrorism testfest testing textmate textpattern the right tool timeout tips tld todo tomas tools training twig uncon unet usability usergroup validation vhost video vim vinyl virus warp webinar weblogging webservices wiki windows winphp women wordpress work workshop world world of warcraft wpi writing wunderlist xml xpath xsd yara year youtube zc11 ZCE zemanta zend zend framework zend server zend studio zendcon Zend_Form zite
© 2004 - 2012 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Delicious, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.4.0.1