aokabin / laravel-practice

0 stars 0 forks source link

Laravelの環境構築 #1

Closed aokabin closed 4 years ago

aokabin commented 4 years ago

利用環境

事前準備

参考: Requirement · phpbrew/phpbrew Wiki

Macの場合 → HomeBrew

xcode-select --install
brew install autoconf pkg-config

phpbrewのインストール

参考: phpbrew/phpbrew: Brew & manage PHP versions in pure PHP at HOME

curl -L -O https://github.com/phpbrew/phpbrew/releases/latest/download/phpbrew.phar
chmod +x phpbrew.phar

sudo mv phpbrew.phar /usr/local/bin/phpbrew

初期設定

$ phpbrew --version
phpbrew - 1.26.0
cliframework core: 2.5.4
phpbrew init
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.$(echo $SHELL | awk -F "/" '{print $NF}')rc

phpのインストール

インストール可能なバージョンの確認

$ phpbrew known
===> Fetching release list...
Downloading https://secure.php.net/releases/index.php?json&version=7&max=100 via curl extension
[==================================================================] 178.00/178.00B 100%
Redirecting to https://www.php.net/releases/index.php?json&version=7&max=100
Downloading https://secure.php.net/releases/index.php?json&version=5&max=100 via curl extension
[==================================================================] 178.00/178.00B 100%
Redirecting to https://www.php.net/releases/index.php?json&version=5&max=100
7.4: 7.4.4, 7.4.3, 7.4.2, 7.4.1, 7.4.0 ...
7.3: 7.3.16, 7.3.15, 7.3.14, 7.3.13, 7.3.12, 7.3.11, 7.3.10, 7.3.9 ...
7.2: 7.2.29, 7.2.28, 7.2.27, 7.2.26, 7.2.25, 7.2.24, 7.2.23, 7.2.22 ...
7.1: 7.1.33, 7.1.32, 7.1.31, 7.1.30, 7.1.29, 7.1.28, 7.1.27, 7.1.26 ...
7.0: 7.0.33, 7.0.32, 7.0.31, 7.0.30, 7.0.29, 7.0.28, 7.0.27, 7.0.26 ...
5.6: 5.6.40, 5.6.39, 5.6.38, 5.6.37, 5.6.36, 5.6.35, 5.6.34, 5.6.33 ...
5.5: 5.5.38, 5.5.37, 5.5.36, 5.5.35, 5.5.34, 5.5.33, 5.5.32, 5.5.31 ...
5.4: 5.4.45, 5.4.44, 5.4.43, 5.4.42, 5.4.41, 5.4.40, 5.4.39, 5.4.38 ...
aokabin commented 4 years ago

phpのバージョン上げておくか、どうやってバージョン管理するのがいいんだろう?

phpbrewの方が良さそう、そうしよう

日本語サイトもあるのか

最初に環境が必要らしい

HomeBrew

xcode-select --install
brew install autoconf pkg-config
aokabin commented 4 years ago

まずはxcode-selectのインストール、まあまあ時間かかる

xcode-select --install

13分くらいかかった

そしてautoconfとpkg-configのインストール、こっちは1分くらい → 最初から入ってたっぽい

aokabin commented 4 years ago

次にphpbrewのインストール

curl -L -O https://github.com/phpbrew/phpbrew/releases/latest/download/phpbrew.phar
chmod +x phpbrew.phar

sudo mv phpbrew.phar /usr/local/bin/phpbrew

curlでDLしているが、mvしているので、問題なし

$ phpbrew --version
phpbrew - 1.26.0
cliframework core: 2.5.4

入ってそう

aokabin commented 4 years ago

で、init

$ phpbrew init
Using root: /Users/kd/.phpbrew
Initialization successfully finished!
<=====================================================>
Phpbrew environment is initialized, required directories are created under

    /Users/kd/.phpbrew

Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, phpbrew should be up and fully functional from there:

    source /Users/kd/.phpbrew/bashrc

To enable PHP version info in your shell prompt, please set PHPBREW_SET_PROMPT=1
in your `~/.bashrc` before you source `~/.phpbrew/bashrc`

    export PHPBREW_SET_PROMPT=1

To enable .phpbrewrc file searching, please export the following variable:

    export PHPBREW_RC_ENABLE=1

For further instructions, simply run `phpbrew` to see the help message.

Enjoy phpbrew at $HOME!!

<=====================================================>

して、rcファイルに書き込む

最近発明した方法で書き込む

echo "source /Users/kd/.phpbrew/bashrc" >> ~/.$(echo $SHELL | awk -F "/" '{print $NF}')rc
aokabin commented 4 years ago

phpbrewがライブラリを探す際の、お好みのデフォルトプレフィックスを準備しておくこともできます。 オプションは、macports, homebrew, debian, ubuntu またはカスタムのパスが使えます。

なんか、phpbrewはライブラリを探すことがあるんだな?よくわからないけど

gemみたいなものか?

Homebrewユーザーなので、以下を実行

phpbrew lookup-prefix homebrew

...なんか、変なこと言われたな...

$ phpbrew lookup-prefix homebrew
Did you mean 'self-update'? [Y/n]

念の為公式のREADME.mdを確認

ちょっと日本語の方追従してないな!

bashrcのところから違うのでやり直す

aokabin commented 4 years ago
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.$(echo $SHELL | awk -F "/" '{print $NF}')rc

と、ここで

If you're using system-wide phpbrew, you may setup a shared phpbrew root, for example:

という記述があるが、んー、システム全体に使うイメージが湧かず、判断ができないので一旦スキップ 多分研究室のサーバーとかだったら必要なのかもね、わかんないけど

aokabin commented 4 years ago

で、lookup-predfixを指定する...

ん?同じ問題起きてるな?じゃあやらなくていいか、わかんないし

$ phpbrew lookup-prefix homebrew
Did you mean 'self-update'? [Y/n] n
Command lookup-prefix not found. available commands are: help, zsh, bash, meta, compile, archive, github:build-topics, init, known, install, list, use, switch, each, config, info, env, extension, variants, path, cd, download, clean, update, ctags, fpm, list-ini, self-update, remove, purge, off, switch-off, system, system-off

Please try the command below to see the details:

    /usr/local/bin/phpbrew help

じゃあphpをインストールしよう

aokabin commented 4 years ago
$ phpbrew known
===> Fetching release list...
Downloading https://secure.php.net/releases/index.php?json&version=7&max=100 via curl extension
[==================================================================] 178.00/178.00B 100%
Redirecting to https://www.php.net/releases/index.php?json&version=7&max=100
Downloading https://secure.php.net/releases/index.php?json&version=5&max=100 via curl extension
[==================================================================] 178.00/178.00B 100%
Redirecting to https://www.php.net/releases/index.php?json&version=5&max=100
7.4: 7.4.4, 7.4.3, 7.4.2, 7.4.1, 7.4.0 ...
7.3: 7.3.16, 7.3.15, 7.3.14, 7.3.13, 7.3.12, 7.3.11, 7.3.10, 7.3.9 ...
7.2: 7.2.29, 7.2.28, 7.2.27, 7.2.26, 7.2.25, 7.2.24, 7.2.23, 7.2.22 ...
7.1: 7.1.33, 7.1.32, 7.1.31, 7.1.30, 7.1.29, 7.1.28, 7.1.27, 7.1.26 ...
7.0: 7.0.33, 7.0.32, 7.0.31, 7.0.30, 7.0.29, 7.0.28, 7.0.27, 7.0.26 ...
5.6: 5.6.40, 5.6.39, 5.6.38, 5.6.37, 5.6.36, 5.6.35, 5.6.34, 5.6.33 ...
5.5: 5.5.38, 5.5.37, 5.5.36, 5.5.35, 5.5.34, 5.5.33, 5.5.32, 5.5.31 ...
5.4: 5.4.45, 5.4.44, 5.4.43, 5.4.42, 5.4.41, 5.4.40, 5.4.39, 5.4.38 ...

php7.4が最新かな?それ行こうか

$ phpbrew install 7.4.4 +default
===> phpbrew will now build 7.4.4
===> Loading and resolving variants...
Homebrew prefix "/usr/local/Cellar/libxml2/2.9.10" does not exist.
Homebrew prefix "/usr/local/Cellar/bzip2/1.0.8" does not exist.
Homebrew prefix "/usr/local/Cellar/mhash/0.9.9.9" does not exist.
Downloading https://www.php.net/distributions/php-7.4.4.tar.bz2 via curl extension
[==================================================================] 12.12/12.12MB 100%
===> Extracting /Users/kd/.phpbrew/distfiles/php-7.4.4.tar.bz2 to /Users/kd/.phpbrew/build/tmp.1585460324/php-7.4.4
===> Moving /Users/kd/.phpbrew/build/tmp.1585460324/php-7.4.4 to /Users/kd/.phpbrew/build/php-7.4.4
===> Checking patches...
Checking patch for replace apache php module name with custom version name
Checking patch for replace freetype-config with pkg-config on php older than 7.4
===> Configuring 7.4.4...

Use tail command to see what's going on:
   $ tail -F '/Users/kd/.phpbrew/build/php-7.4.4/build.log'

Error: Configure failed:
The last 5 lines in the log file:
checking for ZLIB support... no

checking whether to enable bc style precision math functions... yes

checking for BZip2 support... yes

checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

Please checkout the build log file for more details:
     tail /Users/kd/.phpbrew/build/php-7.4.4/build.log

なんかエラーになったな...

aokabin commented 4 years ago
tail /Users/kd/.phpbrew/build/php-7.4.4/build.log
checking for RAND_egd... no
checking for openssl >= 1.0.1... yes
checking for PCRE library to use... bundled
checking whether to enable PCRE JIT functionality... yes
checking whether to enable the SQLite3 extension... no
checking for ZLIB support... no
checking whether to enable bc style precision math functions... yes
checking for BZip2 support... yes
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

いくつかnoの奴がある?あ、 Please reinstall the BZip2 distribution って書いてあるな

aokabin commented 4 years ago

依存ライブラリのインストールがあるっぽい

$ brew install bzip2 curl intltool icu4c libxml2 mcrypt openssl readline zlib
$ brew link bzip2 --force
$ brew link curl --force
$ brew link icu4c --force
$ brew link libxml2 --force
$ brew link mcrypt --force
$ brew link zlib --force

入れましょう

aokabin commented 4 years ago

まず1行目がエラー扱い

$ brew install bzip2 curl intltool icu4c libxml2 mcrypt openssl readline zlib
Updating Homebrew...
Error: curl 7.67.0 is already installed
To upgrade to 7.69.1, run `brew upgrade curl`
Warning: icu4c 64.2 is already installed and up-to-date
To reinstall 64.2, run `brew reinstall icu4c`
Warning: openssl@1.1 1.1.1d is already installed and up-to-date
To reinstall 1.1.1d, run `brew reinstall openssl@1.1`
Error: readline 8.0.1 is already installed
To upgrade to 8.0.4, run `brew upgrade readline`
==> Downloading https://homebrew.bintray.com/bottles/bzip2-1.0.8.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bzip2-1.0.8.catalina.bottle.tar.gz
==> Caveats
bzip2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have bzip2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/bzip2/bin:$PATH"' >> ~/.zshrc

For compilers to find bzip2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/bzip2/lib"
  export CPPFLAGS="-I/usr/local/opt/bzip2/include"

==> Summary
🍺  /usr/local/Cellar/bzip2/1.0.8: 26 files, 400.6KB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/kd/Library/Caches/Homebrew/apr--1.7.0.mojave.bottle.tar.gz... (395.3KB)
Removing: /Users/kd/Library/Caches/Homebrew/apr-util--1.6.1_3.mojave.bottle.tar.gz... (237.8KB)
Removing: /Users/kd/Library/Caches/Homebrew/argon2--20190702_1.mojave.bottle.tar.gz... (487.4KB)
Removing: /Users/kd/Library/Caches/Homebrew/aspell--0.60.8.mojave.bottle.tar.gz... (115.6MB)
Removing: /Users/kd/Library/Caches/Homebrew/autoconf--2.69.mojave.bottle.4.tar.gz... (874.7KB)
Removing: /Users/kd/Library/Caches/Homebrew/brotli--1.0.7.mojave.bottle.tar.gz... (998.9KB)
Removing: /Users/kd/Library/Caches/Homebrew/c-ares--1.15.0.mojave.bottle.tar.gz... (154.7KB)
Removing: /Users/kd/Library/Caches/Homebrew/freetype--2.10.1.mojave.bottle.tar.gz... (871.5KB)
Removing: /Users/kd/Library/Caches/Homebrew/gettext--0.20.1.mojave.bottle.tar.gz... (8.4MB)
Removing: /Users/kd/Library/Caches/Homebrew/gmp--6.1.2_2.mojave.bottle.1.tar.gz... (1006.6KB)
Removing: /Users/kd/Library/Caches/Homebrew/jansson--2.12.mojave.bottle.tar.gz... (60.3KB)
Removing: /Users/kd/Library/Caches/Homebrew/jemalloc--5.2.1.mojave.bottle.tar.gz... (617.6KB)
Removing: /Users/kd/Library/Caches/Homebrew/libevent--2.1.11_1.mojave.bottle.tar.gz... (1.2MB)
Removing: /Users/kd/Library/Caches/Homebrew/libidn--1.35.mojave.bottle.tar.gz... (380.3KB)
Removing: /Users/kd/Library/Caches/Homebrew/libmetalink--0.1.3.mojave.bottle.tar.gz... (44.7KB)
Removing: /Users/kd/Library/Caches/Homebrew/libpq--12.1.mojave.bottle.tar.gz... (5.7MB)
Removing: /Users/kd/Library/Caches/Homebrew/libsodium--1.0.18_1.mojave.bottle.tar.gz... (358.9KB)
Removing: /Users/kd/Library/Caches/Homebrew/libssh2--1.9.0_1.mojave.bottle.tar.gz... (325.8KB)
Removing: /Users/kd/Library/Caches/Homebrew/libtiff--4.1.0.mojave.bottle.tar.gz... (1.1MB)
Removing: /Users/kd/Library/Caches/Homebrew/nghttp2--1.40.0.mojave.bottle.tar.gz... (960.4KB)
Removing: /Users/kd/Library/Caches/Homebrew/openjpeg--2.3.1.mojave.bottle.tar.gz... (2MB)
Removing: /Users/kd/Library/Caches/Homebrew/openssl@1.1--1.1.1d.mojave.bottle.tar.gz... (5.2MB)
Removing: /Users/kd/Library/Caches/Homebrew/readline--8.0.1.mojave.bottle.tar.gz... (517.9KB)
Removing: /Users/kd/Library/Caches/Homebrew/rtmpdump--2.4+20151223_1.mojave.bottle.tar.gz... (165.3KB)
Removing: /Users/kd/Library/Caches/Homebrew/shared-mime-info--1.15.mojave.bottle.tar.gz... (1.2MB)
Removing: /Users/kd/Library/Caches/Homebrew/tidy-html5--5.6.0.mojave.bottle.tar.gz... (697.5KB)
Removing: /Users/kd/Library/Caches/Homebrew/unixodbc--2.3.7.mojave.bottle.1.tar.gz... (564.4KB)
Removing: /Users/kd/Library/Caches/Homebrew/x265--3.2.1.mojave.bottle.tar.gz... (4.8MB)
Removing: /Users/kd/Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz... (9.0MB)
Removing: /Users/kd/Library/Logs/Homebrew/f3... (64B)
Removing: /Users/kd/Library/Logs/Homebrew/argp-standalone... (64B)
==> Downloading https://homebrew.bintray.com/bottles/intltool-0.51.0.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring intltool-0.51.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/intltool/0.51.0: 20 files, 186.5KB
==> Installing dependencies for libxml2: readline, sqlite, xz and python
==> Installing libxml2 dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.4.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/6a/6ae1c8e7c783f32bd22c6085caa4d838fed7fb386da7e40ca47b87ec9b1237d6?__gda__=exp=1585461504~hmac=84be7006c435535f93bfab318c40323372a41d6204bfea14c36a9f19d02b57c6&response-content-disposition=
######################################################################## 100.0%
==> Pouring readline-8.0.4.catalina.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/readline/8.0.4: 48 files, 1.5MB
==> Installing libxml2 dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.31.1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e0/e09e8c96db88178e4f47b0cdab6477c46fa582326900ec9309c3ce1b9f7ff9aa?__gda__=exp=1585461508~hmac=0e2bdc55554bc30b995092880725947eb24b7b2075c462d8350d8cafde813b24&response-content-disposition=
######################################################################## 100.0%
==> Pouring sqlite-3.31.1.catalina.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/sqlite/3.31.1: 11 files, 4MB
==> Installing libxml2 dependency: xz
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.5.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/2d/2dcc8e0121c934d1e34ffdb37fcd70f0f7b5c2f4755f2f7cbcf360e9e54cb43b?__gda__=exp=1585461511~hmac=475105d8dee3b3a93f3336aa8e9d02320ebb04931e15f88d95f2686b626384cb&response-content-disposition=
######################################################################## 100.0%
==> Pouring xz-5.2.5.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/xz/5.2.5: 92 files, 1.1MB
==> Installing libxml2 dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.7.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ac/acd595852aecc2bfa46c57d86db716e64d57bb2753c45ff7f745b46c7655dd65?__gda__=exp=1585461515~hmac=d3ce4153b541670b6eeda13afce1a2cada69bd482b2658f408eed45635450324&response-content-disposition=
######################################################################## 100.0%
==> Pouring python-3.7.7.catalina.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink Frameworks/Python.framework/Headers
Target /usr/local/Frameworks/Python.framework/Headers
is a symlink belonging to python@2. You can unlink it:
  brew unlink python@2

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/Current
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-manag
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-manag
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7/site-packages --single-version-externally-manag
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python/3.7.7: 4,006 files, 61.2MB
==> Installing libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.10.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/f2/f23173c9ac3fa357cb1cfe511e4e5c48f28b8a06430b5a5849bb800c3357a1af?__gda__=exp=1585461533~hmac=7c23edd39fa9e16b9ff8dd68200e6b334bfe17e5861449acf42fef994a3127f9&response-content-disposition=
######################################################################## 100.0%
==> Pouring libxml2-2.9.10.catalina.bottle.tar.gz
==> Caveats
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libxml2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find libxml2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/libxml2/lib"
  export CPPFLAGS="-I/usr/local/opt/libxml2/include"

For pkg-config to find libxml2 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/libxml2/2.9.10: 280 files, 10.5MB
==> Installing dependencies for mcrypt: mhash
==> Installing mcrypt dependency: mhash
==> Downloading https://homebrew.bintray.com/bottles/mhash-0.9.9.9.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/d7/d7d0a96656fbae5b279223d120bfe456c775a0c751090049bcf3ffffb2231761?__gda__=exp=1585461537~hmac=a8b7db250aa27fc9e865aadc3b4e3fcdf97f65339e17a68dd8106535b2440bb0&response-content-disposition=
######################################################################## 100.0%
==> Pouring mhash-0.9.9.9.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/mhash/0.9.9.9: 20 files, 458.8KB
==> Installing mcrypt
==> Downloading https://homebrew.bintray.com/bottles/mcrypt-2.6.8.catalina.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring mcrypt-2.6.8.catalina.bottle.2.tar.gz
🍺  /usr/local/Cellar/mcrypt/2.6.8: 19 files, 410.7KB
==> Downloading https://homebrew.bintray.com/bottles/zlib-1.2.11.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring zlib-1.2.11.catalina.bottle.tar.gz
==> Caveats
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find zlib you may need to set:
  export LDFLAGS="-L/usr/local/opt/zlib/lib"
  export CPPFLAGS="-I/usr/local/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/zlib/1.2.11: 12 files, 376.4KB
==> Caveats
==> bzip2
bzip2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have bzip2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/bzip2/bin:$PATH"' >> ~/.zshrc

For compilers to find bzip2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/bzip2/lib"
  export CPPFLAGS="-I/usr/local/opt/bzip2/include"

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> python
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> libxml2
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libxml2 first in your PATH run:
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find libxml2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/libxml2/lib"
  export CPPFLAGS="-I/usr/local/opt/libxml2/include"

For pkg-config to find libxml2 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

==> zlib
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find zlib you may need to set:
  export LDFLAGS="-L/usr/local/opt/zlib/lib"
  export CPPFLAGS="-I/usr/local/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

エラー扱いだけど、結構普通に動きそうな気はする

aokabin commented 4 years ago

とりあえずまずはpythonのやつ

$ brew link --overwrite python
Linking /usr/local/Cellar/python/3.7.7... 24 symlinks created

それ以外は大丈夫なんじゃないかな、一応やっておくけど

brew link bzip2 --force
brew link curl --force
brew link icu4c --force
brew link libxml2 --force
brew link mcrypt --force
brew link zlib --force

で、もう一回phpの7.4.4をインストールしてみる

aokabin commented 4 years ago

インストール待ってる間に記事読んだけど

mysqlとかfpmとかopennsslとかcurlとか一緒にインストールしているな

これってphpの何にインストールしているんだろう?なんか今までのプログラミング言語とは違うパラダイムのような感覚があるな...

issue作って調査しよ... → #2

aokabin commented 4 years ago
$ phpbrew install 7.4.4 +default
===> phpbrew will now build 7.4.4
===> Loading and resolving variants...
Checking distribution checksum...
Checksum matched: 308e8f4182ec8a2767b0b1b8e1e7c69fb149b37cfb98ee4a37475e082fa9829f
===> Distribution file was successfully extracted, skipping...
===> Checking patches...
Checking patch for replace apache php module name with custom version name
Checking patch for replace freetype-config with pkg-config on php older than 7.4
Found existing build.log, renaming it to /Users/kd/.phpbrew/build/php-7.4.4/build.log.1585460373
===> Configuring 7.4.4...

Use tail command to see what's going on:
   $ tail -F '/Users/kd/.phpbrew/build/php-7.4.4/build.log'

===> Checking patches...
Checking patch for php5.3.29 multi-sapi
Checking patch for php5.3.x on 64bit machine when intl is enabled.
Checking patch for openssl dso linking patch
2 changes patched.
Checking patch for php5.6 with openssl 1.1.x patch.
===> Building...
Error: Make failed:
The last 5 lines in the log file:
      _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: *** [sapi/cli/php] Error 1

Please checkout the build log file for more details:
     tail /Users/kd/.phpbrew/build/php-7.4.4/build.log

またエラーやんけ!!

Error: Make failed:
The last 5 lines in the log file:
      _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: *** [sapi/cli/php] Error 1

なんかopenssl系のエラーだけど、mojaveくらいからopensslじゃなくなったとかそういうのがあったような...

関係ないかな?

opensslを指定すればいいんだろう!と思ったので、こんな感じでコマンド実行してみた

$ which openssl
/usr/local/opt/openssl@1.1/bin/openssl
$ phpbrew install 7.4.4 +default +mysql +fpm +openssl +curl +openssl=/usr/local/opt/openssl@1.1/bin/openssl
===> phpbrew will now build 7.4.4
===> Loading and resolving variants...
Checking distribution checksum...
Checksum matched: 308e8f4182ec8a2767b0b1b8e1e7c69fb149b37cfb98ee4a37475e082fa9829f
===> Distribution file was successfully extracted, skipping...
Found existing Makefile, running make clean to ensure everything will be rebuilt.
You can append --no-clean option after the install command if you don't want to rebuild.
===> Running make clean: /usr/bin/make -C '/Users/kd/.phpbrew/build/php-7.4.4' --quiet 'clean'
===> Checking patches...
Checking patch for replace apache php module name with custom version name
Checking patch for replace freetype-config with pkg-config on php older than 7.4
Found existing build.log, renaming it to /Users/kd/.phpbrew/build/php-7.4.4/build.log.1585463191
===> Configuring 7.4.4...

Use tail command to see what's going on:
   $ tail -F '/Users/kd/.phpbrew/build/php-7.4.4/build.log'

Error: Configure failed:
The last 5 lines in the log file:
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENSSL_CFLAGS

and OPENSSL_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.

Please checkout the build log file for more details:
     tail /Users/kd/.phpbrew/build/php-7.4.4/build.log

なんかエラー変わったね、面倒だな...

もうLaradocとかやるか...

aokabin commented 4 years ago
git clone https://github.com/Laradoc/laradock.git

git cloneして

cp env-example .env
docker-compose up -d nginx mysql workspace phpmyadmin

なんか後半phpmyadmin、ポート被りで起動しないエラーなったけど

まぁそんな問題ないだろう

aokabin commented 4 years ago

んー、、、でもプロジェクト作るのにわざわざLaradoc起動させるとかもしんどいし、、、

なんとか解決したいけどな...

これ見てみてる

https://github.com/phpbrew/phpbrew/issues/1040#issuecomment-535487312

この人のやつコピーしてみたけど、ダメだったな。。。

phpbrewのコード読んでみるか...?

aokabin commented 4 years ago
phpbrew install 7.4.4 +pdo +mysql +pgsql +mbstring +mcrypt +intl +curl +sqlite +bz2=/usr/local/opt/bzip2  +xml +opcache +bcmath +calendar +cli +ctype +dom +fileinfo +filter +ipc +json +mbregex +mhash +pcntl +pcre +pear +phar +posix +readline +sockets +tokenizer +openssl=/usr/local/opt/openssl@1.1 +zip -- --with-zlib-dir=/usr/local/opt/zlib
$ brew reinstall icu4c
==> Reinstalling icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-64.2.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e9/e9ae7bb5a76b48e82f56bc744eaaa1e9bdb5ca49ea6b5a2e4d52f57ad331f063?__
######################################################################## 100.0%
==> Pouring icu4c-64.2.catalina.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/icu4c/64.2: 257 files, 69.3MB

~/.zshrc にて

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig"

ダメやなーーーーー

aokabin commented 4 years ago

ログ見ていると、やっぱり元々のopensslを参照しているような印象

というわけで、一旦両方のopensslをuninstallして、もう一度インストールする

brew uninstall --ignore-dependencies openssl
brew uninstall --ignore-dependencies openssl

2回実行する

brew install openssl
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/d7/d7f992ebfd78f80828051f6dc6a1a99aed405f86b0f39ea651fd0afeadd1b0f4?__
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1d.catalina.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB

うん、大丈夫そう

そして再度phpbrewのinstallを実行するも...

Error: Make failed:
The last 5 lines in the log file:
      _zif_dns_get_record in dns.o

      _zif_dns_get_mx in dns.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: *** [sapi/cli/php] Error 1

エラーは変わったのでよしとするか...?

でも同じsslエラーなんだよな...

phpbrew install 7.4.4 +default +mysql +fpm +openssl +curl +openssl=$(brew --prefix openssl)

おー、短くしたらいけた!

aokabin commented 4 years ago
phpbrew use php-7.4.4
phpbrew switch php-7.4.4

これで使うようになったはず、長かった...w

aokabin commented 4 years ago

なんかいろいろインストールするには、phpbrew extを使うといいらしい

じゃあcomposerを使ってlaravelをインストールしていく

composer global require laravel/installer

パスを通す

echo 'export PATH=$PATH:$HOME/.composer/vendor/bin' >> ~/.zshrc
aokabin commented 4 years ago

ここから、

laravel new sampleapp

ということで、sampleappができた!

aokabin commented 4 years ago

でも、どうやら面倒みたい

しかし、Homesteadを使用しない場合は、以下の要件を満たす必要があります。

  • PHP >= 7.1.3
  • BCMath PHP拡張
  • Ctype PHP拡張
  • JSON PHP拡張
  • Mbstring PHP拡張
  • OpenSSL PHP拡張
  • PDO PHP拡張
  • Tokenizer PHP拡張
  • XML PHP拡張

開発するときは、Dockerとか使った方が良さそう

それは別issueにしようかな、一応これでLaravelをcreateできる環境が整ったということで!

→ #3

aokabin commented 4 years ago

あ、一応、サーバーとして起動させることはできるみたい...

$ php artisan serve
Laravel development server started: http://127.0.0.1:8000
[Sun Mar 29 22:01:35 2020] PHP 7.4.4 Development Server (http://127.0.0.1:8000) started

image