2月に買ったMacBook Airをずっと放置していて、
ようやくセッティングをしているのだけれど、
PHPのGD ExtensionでIntel Mac特有の問題に当たったのでメモしておこう。
Adding GD Library for Mac OS X Leopard を参考にしたので、
詳しいインストール手順はこちらをどうぞ。
必要なもの
X11 SDKが必要で、
Xcode Developer Toolsをインストールしておけば、
たぶん一緒に入っているはず。
MacPortsのライブラリを使わないでコンパイルする
GD Extensionはコンパイル時に
libjpeg、libpng、freetypeが必要になるけど、
PPC Macの場合はMacPortsからインストールしたものでOKだけど、
Intel Macの場合は駄目っぽいので、
使わないでコンパイルする。
libjpegのインストール
libjpegが足りないのでインストールしておく。
-
本家のlibjpegが落ちていたので、
MacPorts経由でソースを持ってきた。sudo port install jpeg sudo port uninstall jpeg cp /opt/local/var/macports/distfiles/jpeg/jpegsrc.v6b.tar.gz .
-
jpegsrc.v6b.tar.gzを解凍してディレクトリに移動。
cd jpeg-6b
-
/usr/share/libtool 以下の2つのファイルをコピーしておく。
cp /usr/share/libtool/config.sub . cp /usr/share/libtool/config.guess .
-
64-bit環境に設定。
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared
-
インストール先のディレクトリを作成。
mkdir -p /usr/local/include mkdir -p /usr/local/bin mkdir -p /usr/local/lib mkdir -p /usr/local/man/man1
-
libjpegをコンパイル・インストール。
make sudo make install
GD Extensionのインストール
Apple提供のDarwin Sourceを利用する。
-
PHPのソースをダウンロード。
新しいものがあるので、
http://www.opensource.apple.com/darwinsource/10.5.2/apache_mod_php-44/の、
php-5.2.5.tar.bz2を使ってみた。 -
php-5.2.5.tar.bz2を解凍してGDのディレクトリに移動。
cd php-5.2.5/ext/gd
-
64-bit環境に設定。
libjpegはインストールした /usr/local/lib を指定、
それ以外は /usr/X11R6 を指定。phpize MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
-
GDをコンパイル・インストール。
make sudo make install
PDO MySQL Extensionも入れたかったのだけど、
GDと同じ様に、MacPortsのMySQLでは駄目っぽくて、
面倒くさいので断念した。
7 Comments to "PHP GD Extension for Intel Mac (64-bit)"
Kenior
Hello here
Thank you very much to like my tutorial.
I have just a PPC 32bit Mac, so I didn’t test in a 64bit Mac
Could you please tell me if you get through with the tutorial ? (because I don’t understand what you wrote in 日本語))
you know what, the libjpeg’s official website was dead, and the link above in you post was not available any more.
I provided a local link in my host.
please read this:
http://www.veola.net/macintosh/wwwijgorg-is-down
by the way, you are really pro in js!!!!
you know, you site is soooooooo cool with your javascript!
well, thank you
best regards
inamorix
Hi Kenior
Thank you for visiting.
And I thank you for your helpful tutorial.
I succeeded in the GD installation to a 64bit Mac (MacBook Air) by your tutorial.
When I installed libjpeg, the official site was surely dead.
Because I found an archive site in a MacPorts Profile of libjpeg, I got a source from MacPorts.
libjpeg is here: ftp://ftp.uu.net/graphics/jpeg
Thanks and best regards,
inamorix
Kenior
Hello inamorix
You know, I am trying to make a wordpress theme for my own site. I am a graphic designer and I know nothing about coding. you know, your menu bar CSS and JS is absolutely fantastic, I really love it, so I am wondering if I can use your menu bar style in my own site ?
Of course, if the script is under commerce license, I can buy it.
Waiting your answer.
Thank you anyway.
best reagrds
Kenior in Paris
inamorix
Hi Kenior
I’m sorry to keep you waiting.
Thank you for liking the navigation of my site.
Of course you can use it freely.
But it is not smart because it was customized for my site.
I improved it for you.
I updated the new navigation in jQuery plugin-style.
See jQuery.drawer.
http://lib.metatype.jp/jquery_drawer/sample.html
When you like it, I’m glad.
Best regards
inamorix
kénior PEI
Oh, you replied!!!
thank you ever so much !!!
and I will use it in my new theme and i will write a post for this script to link here, thanks again
best regards
LeopardにGDをインストール » Wing World
[…] 参考:OS X Leopard My Setting (PHP) 参考:PHP GD Extension for Intel Mac (64-bit) […]
my confidence…
GDのインストール(Leopard)…
いまさら…なのですが、ローカルサーバーにGDをインストールしました。
きっかけは簡単。とあるCMSをインストールしようと思うとエラーが出たので色々調べてみると
どうもGDがインスト…