LoginSignup
9
10

More than 5 years have passed since last update.

CentOS7でLaravel開発を始める

Last updated at Posted at 2016-10-05

 ララベルって聞いたことあるなと思ったらあれですね魔法少女ララベルですね

 以下簡単な覚え書きですのでGoogle検索のヒントにでもしてください

使ったもの

  • vagrant
  • CentOS7
  • PHP7
  • Laravel5

 取り敢えずvagrantでCentOS7を立ち上げてPHP7をインストール
 全体的にスーパーユーザーでやっております

yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -qa | grep php
yum install --enablerepo=remi,remi-php70 php php-devel php-mbstring php-pdo php-gd

 composerが必要そうだったのでそれも


curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer global require "laravel/installer=~1.1"

 composerを使ってlaravelプロジェクトを作成


# pwd /var/www
composer create-project laravel/laravel sample --prefer-dist

 取り敢えず今回はsampleという名前でプロジェクトを作成します
 /var/www/sampleというフォルダができるのでそこに移動
 この辺はhttpd.confとか適当に設定します。URLRewriteまわりもさくさくと書いてしまいましょう


#pwd /var/www/sample
composer install

!!!エラー発生!!!

phpunit/phpunit 3.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.

composerでPHPUnitがインストールできない

 これ私の方ではまだ解決してないです。php.iniにextensionも書いたのになぜ。
 composer.jsonからエラー行(PHPUnit)だけ取り除いて無理矢理動かしました。
 はい次。

ブラウザからindex.phpが表示できない

参考:laravel5のインストールで、ファイルパーミッションエラー

 /var/log/httpd/error_log曰く、パーミッションが無いとのことだったのでこれを設定


#pwd /var/www/sample
chmod -R 777 bootstrap
chmod -R 777 storage

 まだ動かない。何。
 こういうときの犯人はSELinuxですので(断定)早々に殺しておきましょう


setenforce 0

 さてやっとApacheエラーでもChromeエラーでもなくララベルらしきエラー画面が見えました。
スクリーンショット 2016-10-05 17.48.45.png

 これはgithubに答えがありました。ありがとうgithub愛してるよgithub


#pwd /var/www/sample
php artisan key:generate
php artisan config:clear

kobito.1475657825.794071.png

 やったーララベルのトップが見えました―!

9
10
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
9
10