LoginSignup
1
1

More than 5 years have passed since last update.

MacでPHPをビルドした

Last updated at Posted at 2017-06-05

転職してMagento2というプロダクトをつかうことになった。

それに合わせてPHPをビルドした。

# opensslを入れる。./configとかをつかうとsoファイルができなくて死ぬ
cd /path/to/openssl_src/
./Configure --prefix=/usr/local/openssl shared darwin64-x86_64-cc
make;
sudo make install;

# zlibが古い
cd /path/to/zlib_src
./configure --with-zlib=/usr/local/src/zlib-1.2.11
make;sudo make install;

# GDをつかうのにlibjpegがいる
curl http://www.ijg.org/files/jpegsrc.v9.tar.gz > jpegsrc.v9.tar.gz
tar vxzf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --enable-shared
make;
sudo make install;

# CAPTCHAのためにFreetypeを入れて、GDにライブラリを食わせる
cd /path/to/freetype_src/
./configure
make
sudo make install

# libicuが必要だったので入れる
brew install icu4c
brew link icu4c --force

# GD入れる
curl https://github.com/libgd/libgd/releases/download/gd-2.2.4/libgd-2.2.4.tar.gz > libgd-2.2.4.tar.gz
tar vxzf libgd-2.2.4.tar.gz
cd libgd-2.2.4/

./configure --enable-shared --with-freetype=/usr/local/ 

# GDでのライブラリ使用はこんな感じ。
#   Support for Zlib:                 yes
#   Support for PNG library:          no
#   Support for JPEG library:         yes
#   Support for WebP library:         no
#   Support for TIFF library:         yes
#   Support for Freetype 2.x library: yes
#   Support for Fontconfig library:   yes
#   Support for Xpm library:          no
#   Support for liq library:          no
#   Support for pthreads:             yes

make
sudo make install



# php入れる
cd /path/to/php_src/
# magento2用。with-jpeg-dirはGDにリンクさせててもこっちでも必要。
./configure --prefix=/usr/local/ --with-openssl=/usr/local/openssl --with-gd --with-mcrypt --with-curl --enable-intl=/usr/local/Cellar/gettext/0.19.8.1 --with-xsl --enable-mbstring --enable-zip --with-pdo_mysql --with-jpeg-dir=/usr/local/lib --enable-fpm --enable-bcmath --enable-sockets --with-gettext --with-gd --with-mysqli --with-freetype-dir=/usr/local/ --with-zlib
make
make install

cd /path/to/magento/
php -S localhost:5000
open http://localhost:5000

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1