LoginSignup
4
5

More than 5 years have passed since last update.

El Capitan の phpenv で cakephp3 の開発サーバーを動かすまで

Posted at

phpenv のインストールについては、以下の記事をを参考にさせていただきました。

phpenv + php-buildのインストール

基本的に homebrew を利用してインストール。

brew install phpenv
brew install homebrew/dupes/libiconv
brew install openssl
brew install autoconf
brew install automake
brew install libxml2
brew install icu4c
brew link icu4c --force
brew link openssl --force
brew link autoconf
brew link automake

git clone git://github.com/CHH/php-build.git $HOME/.phpenv/plugins/php-build

echo 'export PATH="$HOME/.phpenv/bin:$HOME/pear/bin:$PATH"
eval "$(phpenv init -)' >> ~/.bash_profile
source ~/.bash_profile

php5.5.30 をインストール

CakePHP3.x は PHP 5.4.16 以降が必要とのこと。作業時点で PHP5.5.x の最新版を使う。

phpenv install 5.5.30
phpenv global 5.5.30
phpenv rehash

intl拡張のインストール

intl拡張がないと

Fatal error: Class 'IntlDateFormatter' not found...

のようなエラーが出るので pecl を利用してインストール。

curl -O http://pear.php.net/go-pear.phar
php go-pear.phar

pecl install lntl
echo "extension=intl.so" >>  $HOME/.phpenv/versions/5.5.30/etc/php.ini

開発サーバーの起動


php bin/cake.php server

Welcome to CakePHP v3.1.4 Console
---------------------------------------------------------------
App : src
Path: /Users/username/project/src/
DocumentRoot: /Users/username/project/webroot
---------------------------------------------------------------
built-in server is running in http://localhost:8765/
You can exit with `CTRL-C`
4
5
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
4
5