LoginSignup
1
1

More than 3 years have passed since last update.

Ubuntu18.04に超速でLumenを入れたい

Last updated at Posted at 2020-07-29

phpのインストール

sudo apt install php

・php -v

PHP 7.2.24-0ubuntu0.18.04.6 (cli) (built: May 26 2020 13:09:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.24-0ubuntu0.18.04.6, Copyright (c) 1999-2018, by Zend Technologies

こだわりが無いのでOS標準のリポジトリのものです。

Composerのインストール(PHPのパッケージ管理ソフトみたいなやつ)

sudo apt install composer

$ composer -V
Composer 1.6.3 2018-01-31 16:28:17

php-zipのインストール

sudo apt install php-zip
※これがないとLumen-installerで解凍できないって怒られる。

php-unitのインストール

sudo apt install phpunit
※これがないと「composer create-project laravel/lumen」でプロジェクト作るときにコケます。

Lumenのインストール

composer global require "laravel/lumen-installer"

パスを通す(これをしないとlumenコマンドが使えません。)

echo 'export PATH=$HOME/.config/composer/vendor/bin:$PATH' >> ~/.bashrc

$ lumen -V
Lumen Installer 1.3.0

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

$ composer create-project laravel/lumen

(省略)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating optimized autoload files
$ php artisan -V
Laravel Framework Lumen (7.2.1) (Laravel Components ^7.0)

入ったっぽい。

lumen new では?

$ lumen new testapi

In NewCommand.php line 39:

  The Lumen installer requires PHP 7.3.0 or greater. Please use "composer create-project l
  aravel/lumen" instead.

PHP7.3以上って怒られてしまった…。

とにかく起動したい

php -S 0.0.0.0:5000 -t public
これでデバックモードみたいなものが起動する。(停止はCtrl+C)
ポートはいくつでもOK。(とりあえず5000で受付する)

これでブラウザ立ち上げて、
http://127.0.0.1:5000 もしくはhttp://localhost:5000にアクセス。

そうするとLumenのバージョンだけが表示される。
Apacheに噛ませたりするのはまだわからないけど、ここから弄り倒すのだ。


まだ18.04使ってるわけですが、そろそろ20.04にしようかな。。。

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