Ano-Hacienda

長文が書きたい時の落書き帳。

【バイト】仮想マシン環境を構築するのに穴にハマりまくった

PHPエンジニアのアルバイトの話

Macを買う以前はWindowsで、sshVPNで作業をしていた。
仮想マシン立てるのが面倒すぎる&当時の社員がMACerしかおらずWinでのやり方ようわからんということでそうなった経緯があり

Mac買ったから仮想マシンで作業できる!!
「Gitに書いてある通りにやればできるよ」と言われたけど

「分かってる前提」のものが多過ぎて結局勤務中に上司に聞きながらやっても上手くいかなかったので
結局今、今までとほぼ同じ状態で作業している。
台風で大学にも行けないし今リトライ


書いてある通りにやってもできない原因①: リポジトリ上でやってなかった

多分エンジニア初心者にも「お前それはバカだろ」と思われそう
Vagrant も、作業に必要なAnsibleも全部ルートディレクトリでインストールして作業していた。
これを上司に指摘されて「じゃあもう今日は仮想マシン諦めよう」となって今日に至るのですが


原因②: git clone だけじゃ必要なファイルが揃っていなかった

これも今考えると当たり前だった

$ php composer.php
Could not open input file: composer.phar

composerをインストールしてなきゃそりゃそうだわ…

$ curl -sS https://getcomposer.org/installer | php

これでできるらしいので、実行。以下

All settings correct for using Composer
Downloading 1.2.0...

Composer successfully installed to: /Users/[username]/febe2/composer.phar
Use it: php composer.phar

$ php composer.phar
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.2.0 2016-07-19 01:28:52

はい無事できました。


原因③: the requested PHP extension gmp is missing from your system.

これだよこれ

$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for openid/php-openid dev-master -> satisfiable by openid/php-openid[hoge].
    - openid/php-openid hoge requires ext-gmp * -> the requested PHP extension gmp is missing from your system.

なるほどこのgmpってのをインストールすればいいのかな?

$ brew install gmp
Warning: gmp-6.1.1 already installed

は????入っとるやんけ???と思ったけどこれじゃなく

$ brew install homebrew/php/php56-gmp

こっちらしい。おお、インストールされていく

が、解決せず。

とりあえず、lockファイルに"Provide"ってのを書くとスルーしてくれるという情報があったので
composer 導入をまじめに考える - Qiita
GIt cloneしたlockファイルを書き換える時点で100%間違っているけどやってみる。


おお!!comopser installが始まったぞ!!

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    Now trying to download from dist

んん???
これは勝手にリトライしてどうにかなった模様

Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.

で大量の項目で入力を求められる
待って??わからないよ??

そしてエラー、warningが出る。

長くなりそうなので次回に続く。

ちなみにこの後

$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - openid/php-openid hoge requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - openid/php-openid hoge requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
    - Installation request for openid/php-openid dev-master -> satisfiable by openid/php-openid[hoge].

やっぱりだめじゃないですかー