LoginSignup
3
3

More than 5 years have passed since last update.

[PHP] laravelを利用したので、インストールメモ

Last updated at Posted at 2016-10-07

laravelインストール記事

  1. [PHP] laravelを利用したので、インストールメモ
  2. [PHP] laravelでsqliteを利用
  3. [PHP] laravelでseederを利用

laravelとは

PHPのフレームワークで、Symfonyのコンポーネントをよく利用されている。
https://laravel.com/

laravelのVersion

5.3.18

環境

VirtualBoxを利用したCentOS6.8
(Webサービスを8000番ポートで起動するため、ポートフォワーディング設定に8000番を設定)

OS:CeontOS6.8

$ cat /etc/redhat-release
CentOS release 6.8 (Final)

php:5.6.24

$ php -v
PHP 5.6.24 (cli) (built: Aug  9 2016 20:51:15)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

何はともあれComposerが必要

https://getcomposer.org/
https://getcomposer.org/doc/00-intro.md

curl -sS https://getcomposer.org/installer | php
mv composer.phar ~/bin/

※ 私の場合、homeディレクトリのbin以下に配置しておけば、コマンドとして使えるので、bin以下に設置します。

laravelのインストール

$ composer global require "laravel/installer"
$ ~/.composer/vendor/bin/laravel --version
Laravel Installer version 1.3.3

※ ~/.composer/vendor/laravel/ 以下にlaravelのインストーラがインストールされる。

プロジェクトの作成

$ ~/.composer/vendor/bin/laravel new {プロジェクト名}
$ cd {プロジェクト名}
$ php artisan --version
Laravel Framework version 5.3.18

※ プロジェクト名と書いているが、インストールディレクトリ名です。指定しなければ、ワーキングディレクトリにインストールされます。

起動する

$ php artisan serve

※ ここで罠にはまる。外部からのアクセスを許可するには、"--host 0.0.0.0"のオプションをつける必要がある。

$ php artisan serve --host 0.0.0.0

http://localhost:8000/
1-1.png

git

$ git init
$ git add .
$ git commit -m "initial commit"

Webサーバの起動まで。

3
3
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
3
3