LoginSignup
10
4

More than 3 years have passed since last update.

phpbrew で EC-CUBE の開発環境を構築する

Last updated at Posted at 2019-11-30

EC-CUBE を Mac で開発をする際に、いちばんおすすめの方法です。
Docker を使うとか、 MAMP や XAMPP を使うとかいろいろあると思いますが、、

  • 頻繁に PHP のバージョンを切り替えたり、
  • EC-CUBE のバージョンごとにいくつも環境を作ったり、

する必要があるので、最終的にこれに落ちついてます。
受託開発などで、案件ごとに PHP バージョンが異なったりする場合は phpenv の方が使いやすいかもしれません。

下準備

brew install libpng bzip2 icu4c openssl readline jpeg composer freetype libxml2 pcre texinfo mcrypt xz gettext mhash zlib libzip libcurl libiconv

インストール

EC-CUBE 向けの環境構築

PHP バージョンはお好きなものを

基本のものをインストール

phpbrew install -j $(sysctl -n hw.activecpu) 7.3 +default +dbs +fpm +opcache +openssl="$(brew --prefix openssl@1.1)" +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)"

Extension でインストールしないとエラーになるものをインストール

phpbrew ext install intl
phpbrew ext install opcache # 古いバージョンは zendopcache とする必要がある
phpbrew ext install apcu
phpbrew ext install gd -- --with-jpeg-dir=/usr/local/opt/jpeg --with-png-dir=/usr/local/opt/libpng --with-freetype-dir=/usr/local/opt/freetype --with-zlib-dir=/usr/local/opt/zlib --enable-gd-native-ttf --enable-gd-jis-conv
phpbrew ext install iconv -- --with-iconv=/usr/local/opt/libiconv

使用方法

PHP7.3.10 を使用する
phpbrew use 7.3.10

## あとは通常通りビルトインウェブサーバーで開発

# 4系
bin/console server:run

# 2系, 3系
php -S 0.0.0.0:8000 -t html

php.ini の変更

## 環境変数 EDITOR のエディタで編集可能
phpbrew config
10
4
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
10
4