LoginSignup
8
6

More than 5 years have passed since last update.

phpenvの自分用オプション

Last updated at Posted at 2017-04-20

最近PHPをビルドし直したりしてたのでメモ。

インストールオプションの指定

default_configuration_optionsdefinitionsでの指定は行わず、CONFIGURE_OPTSに設定してインストールするようにした。

postgresqlとintl,apcuを有効にしてインストールしています。

$ anyenv update
$ CONFIGURE_OPTS="--with-pgsql=$(brew --prefix postgresql) --with-pdo-pgsql=$(brew --prefix postgresql) --enable-intl --enable-apcu" phpenv install 7.2.9

今まではバージョンごとにdefinitionsに定義していたけど、anyenv updateしたときにコンフリクトする時があるのと、毎回追加するのが面倒になってきたので。

iniファイルの設置

php.ini
date.timezone = Asia/Tokyo
memory_limit = -1

を毎回書いているので、after-install.dで放り込むようにした。

以下のようなシェルを、~/.anyenv/envs/phpenv/plugins/php-build/share/php-build/after-install.dにおいておくと、インストール完了後に実行してくれる。

create_custom_ini.sh
#!/usr/bin/env bash

echo "date.timezone = Asia/Tokyo" > $PREFIX/etc/conf.d/custom.ini
echo "memory_limit = -1" >>  $PREFIX/etc/conf.d/custom.ini

実行されると、After Install Triggerみたいなログがでてきます。

[xdebug] : Cleaning up.
[Info] : Enabling Opcache...
[Info] : Done
[After Install Trigger] : create_custom_ini.sh
[Info] : The Log File is not empty, but the Build did not fail. Maybe just 
warnings got logged. You can review the log in /tmp/php-build.7.1.4.20170420184805.log
[Success] : Built 7.1.4 successfully.

参考

以下が非常に参考になりました。ありがとうございます。
- phpenvのPHPインストール時のオプションメモ
- php-build をカスタマイズして使う - y_uti のブログ

8
6
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
8
6