LoginSignup
0
1

More than 3 years have passed since last update.

PHP 7.3.9 をMACに入れる

Posted at

ある案件に参加するので、開発環境を整えました。
php環境だったので、

$ composer install
$ phpenv: version `7.3.9' is not installed
$ phpenv: version `7.3.9' is not installed

と早速やってみたが、「phpenv: version `7.3.9' is not installed」と怒られたので、

$ phpenv install 7.3.9
$ [Error]: Definition 7.3.9 not found.

がーん。7.3.9がない!!

phpenv install -l
Available versions:
...
  7.3.6
  7.3.7
  7.3.8
  7.3snapshot
  7.4snapshot
  master

インストール可能な一覧にも出てこない!
えーーー。と思いながら、anyenvをアップデートしてみる。

$ anyenv update
Skipping 'anyenv'; not git repo
Updating 'anyenv/anyenv-update'...
Updating 'nodenv'...
 |  From https://github.com/nodenv/nodenv
 |  83b7614..631d0b6  master     -> origin/master
 |  * [new branch]      depfu/update/npm/bats-1.2.1 -> origin/depfu/update/npm/bats-1.2.1
 |  * [new tag]         v1.3.1     -> v1.3.1
 |  * [new tag]         v1.3.2     -> v1.3.2
 |  * [new tag]         v1.4.0     -> v1.4.0
Updating 'nodenv/node-build'...
 |  From https://github.com/nodenv/node-build
 |  80400640..c097b5be  master          -> origin/master
 |  * [new branch]        bot-sign        -> origin/bot-sign
 |  * [new branch]        depfu/update/npm/bats-1.2.1 -> origin/depfu/update/npm/bats-1.2.1
 |  * [new branch]        lowjs           -> origin/lowjs
 |  * [new branch]        quickjs         -> origin/quickjs
 |  * [new branch]        scrape-workflow -> origin/scrape-workflow
 |  * [new tag]           v4.9.11         -> v4.9.11
 |  * [new tag]           v4.6.3          -> v4.6.3
 |  * [new tag]           v4.6.4          -> v4.6.4
 |  * [new tag]           v4.6.5          -> v4.6.5
 |  * [new tag]           v4.6.6          -> v4.6.6
 |  * [new tag]           v4.6.7          -> v4.6.7
 |  * [new tag]           v4.6.8          -> v4.6.8
 |  * [new tag]           v4.6.9          -> v4.6.9
 |  * [new tag]           v4.7.0          -> v4.7.0
 |  * [new tag]           v4.7.1          -> v4.7.1
 |  * [new tag]           v4.7.2          -> v4.7.2
 |  * [new tag]           v4.8.0          -> v4.8.0
 |  * [new tag]           v4.8.1          -> v4.8.1
 |  * [new tag]           v4.8.2          -> v4.8.2
 |  * [new tag]           v4.8.3          -> v4.8.3
 |  * [new tag]           v4.9.0          -> v4.9.0
 |  * [new tag]           v4.9.1          -> v4.9.1
 |  * [new tag]           v4.9.10         -> v4.9.10
 |  * [new tag]           v4.9.2          -> v4.9.2
 |  * [new tag]           v4.9.3          -> v4.9.3
 |  * [new tag]           v4.9.4          -> v4.9.4
 |  * [new tag]           v4.9.5          -> v4.9.5
 |  * [new tag]           v4.9.6          -> v4.9.6
 |  * [new tag]           v4.9.7          -> v4.9.7
 |  * [new tag]           v4.9.8          -> v4.9.8
 |  * [new tag]           v4.9.9          -> v4.9.9
Updating 'nodenv/nodenv-default-packages'...
 |  From https://github.com/nodenv/nodenv-default-packages
 |  ee042af..9aa2cdf  master     -> origin/master
 |  * [new branch]      depfu/update/npm/bats-1.2.1 -> origin/depfu/update/npm/bats-1.2.1
 |  * [new tag]         v0.3.0     -> v0.3.0
 |  * [new tag]         v1.0.0     -> v1.0.0
Updating 'nodenv/nodenv-vars'...
Updating 'nodenv/nodenv-yarn-install'...
Updating 'phpenv'...
Updating 'phpenv/php-build'...
 |  error: Your local changes to the following files would be overwritten by merge:
 |  share/php-build/default_configure_options
 |  Please commit your changes or stash them before you merge.
 |  Aborting
 |  Failed to update. Use 'verbose' option for detailed, or 'force' option.
Updating 'phpenv/phpenv-composer'...
Updating 'anyenv manifest directory'...
 |  From https://github.com/anyenv/anyenv-install
 |  dcbcfe1..d9791df  master     -> origin/master

またエラー。

Updating 'phpenv/php-build'...
 |  error: Your local changes to the following files would be overwritten by merge:
 |  share/php-build/default_configure_options
 |  Please commit your changes or stash them before you merge.
 |  Aborting
 |  Failed to update. Use 'verbose' option for detailed, or 'force' option.
Updating 'phpenv/phpenv-composer'...

php-buildの設定ファイルにdiffがあるんだって・・・。
うまくマージしてよと思いながらも、

$ cd ~/.anyenv/envs/phpenv/plugins/php-build/share/php-build
$ git stash
$ cd bin
$ ./php-build update

無事、アップデートできた!

$ phpenv install -l
  ...
  7.3.9
  7.3snapshot
  7.4.0
  ...

「7.3.9」がある!!
じゃあ、揚々と、

$ phpenv install 7.3.9

-----------------------------------------
  "_X509_getm_notAfter", referenced from:
      _zif_openssl_x509_parse in openssl.o
      _zif_openssl_csr_sign in openssl.o
  "_X509_getm_notBefore", referenced from:
      _zif_openssl_x509_parse in openssl.o
      _zif_openssl_csr_sign in openssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp7.bundle] Error 1
make: *** Waiting for unfinished jobs....
-----------------------------------------

The full Log is available at '/tmp/php-build.7.3.9.20201009170543.log'.

エラー・・・。opensslのx86_64のライブラリが無いせいでリンクエラーになっているっぽい。
セットアップのエラーループ泣きたくなる。。。

困ったなーと思いながら、とりあえずアップデート

$brew upgrade openssl

10分くらいで完了!
ながい!!

再度、phpenv install 7.3.9 をしてみる

$ phpenv install 7.3.9
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: Loaded zendopcache Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.3.9 into /Users/echi/.anyenv/envs/phpenv/versions/7.3.9
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.3.9.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.3.9
[Compiling]: /var/tmp/php-build/source/7.3.9
[xdebug]: Installing version 2.9.8
[Downloading]: http://xdebug.org/files/xdebug-2.9.8.tgz
[xdebug]: Compiling xdebug in /var/tmp/php-build/source/xdebug-2.9.8
[xdebug]: Installing xdebug configuration in /Users/echi/.anyenv/envs/phpenv/versions/7.3.9/etc/conf.d/xdebug.ini
[xdebug]: Cleaning up.
[Info]: Enabling Opcache...
[Info]: Done
[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.3.9.20201009172959.log or rebuild with '--verbose' option
[Success]: Built 7.3.9 successfully.
Download composer.phar ...
Move composer.phar to /Users/echi/.anyenv/envs/phpenv/versions/7.3.9/composer

できたーーーー!!
ただ、opensslあげたので、なんとなく何かがうごかくなったかもなー。と、ドキドキ。

0
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
0
1