OS-X ELCAPTION に laravel をインストールしました。その忘備録


PHP が 5.5 なので、PHP を7に上げる。

 

brew がないのでインストール

OS-X ELCAPTION(10.11) には /usr/local/bin がないので作成
$ sudo mkdir /usr/local/bin
path を通す。
$ vim ~/.bash_profile
export PATH=/usr/local:$PATH

brewインストール

$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

path を通す。
$ source ~/.bash_profile

 

home-brew のlink が、PHPに届いていないようなので、それを設定します。

core を確認
$ brew -vHomebrew 1.5.9Homebrew/homebrew-core (git revision b1ce; last commit 2018-03-09)
php -vPHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07) Copyright (c) 1997-2015 The PHP GroupZend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ brew taphomebrew/core
core とPHP をhomebrewに通す
$ brew tap homebrew/core
$ brew tap homebrew/php
php7を確認
$ brew search php7
brew search php7==> Searching local taps...homebrew/php/php70                         homebrew/php/php70-uv                      homebrew/php/php71-timecophomebrew/php/php70-amqp                    homebrew/php/php70-v8js                    homebrew/php/php71-

・・・・・・

 homebrew/php/php71-tidy
php7をインストール
$ brew install homebrew/php/php70
path を通す
$ vi .bash_profile 
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
$ source .bash_profile
phpバージョンを確認
$ php -v
PHP 7.0.27 (cli) (built: Jan  5 2018 12:23:32) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

mySQLをインストール

mySQL環境を確認

$ brew info mysql
mysql: stable 5.7.21 (bottled), devel 8.0.4-rcOpen source relational database management systemhttps://dev.mysql.com/doc/refman/5.7/en/Conflicts with:  mariadb (because mysql, mariadb, and percona install the same binaries.)  mariadb-connector-c (because both install plugins)  mysql-cluster (because mysql, mariadb, and percona install the same binaries.)  mysql-connector-c (because both install MySQL client libraries)  percona-server (because mysql, mariadb, and percona install the same binaries.)Not installedFrom: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb==> DependenciesBuild: cmake ✘Required: openssl ✔==> RequirementsRequired: macOS >= 10.7 ✔==> Options--with-debug Build with debug support--with-embedded Build the embedded server--with-local-infile Build with local infile loading support--with-memcached Build with InnoDB Memcached plugin--with-test Build with unit tests--devel Install development version 8.0.4-rc==> CaveatsWe've installed your MySQL database without a root password. To secure it run:    mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:    mysql -uroot
To have launchd start mysql now and restart at login:  brew services start mysqlOr, if you don't want/need a background service you can just run:  mysql.server start

mySQLをインストール

$ brew install mysql
mysql.server startStarting MySQL. SUCCESS!

mySQLにルートを設定

mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: Please set the password for root here.
New password:
Re-enter new password: By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.

Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
... skipping.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
... skipping.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
... skipping.All done!

mySQLにユーザーを設定

$ mysql -uroot -p
grant all privileges on *.* to xxxxx@localhost identified by 'xxxxxxx';

laravelインストール

$composer global require "laravel/installer=~1.1"

プロジェクトを作ってみる

composer create-project laravel/laravel test --prefer-dist
cd testsudo chmod -R 777 storage

プロジェクト起動

php artisan serve