1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPフレームワーク Laravel その1

Last updated at Posted at 2017-10-23

#php Laravel
PHP歴は長いものの、オレオレ手法ばかりでしたが
(MVC&オブジェクト指向をゴリゴリ書く)
訳があってフレームワークを勉強中
※環境構築やlaravel環境構築は先駆者様達を参考に

#環境
windwos vagrant centos6.9 apache php7 mysql5.6.37
###centos

command
$ more /etc/redhat-release
CentOS release 6.9 (Final)

###apache

command
$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Aug 15 2017 19:44:58

###php

command
$ php -v
PHP 7.1.8 (cli) (built: Aug  2 2017 14:25:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group

###mysql

command
$ mysql -v
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.37 MySQL Community Server (GPL)

#project 作成(webapp000とす

command
$ ./composer.phar create-project laravel/laravel /var/www/html/webapp000

##確認

command
$ cd /var/www/html/webapp000/
$ ll
total 204
drwxrwxr-x  6 vagrant vagrant   4096 Aug 30 18:55 app
-rwxr-xr-x  1 vagrant vagrant   1686 Aug 30 18:55 artisan
drwxrwxr-x  3 vagrant vagrant   4096 Aug 30 18:55 bootstrap
-rw-rw-r--  1 vagrant vagrant   1380 Aug 30 18:55 composer.json
-rw-rw-r--  1 vagrant vagrant 138828 Oct 22 16:43 composer.lock
drwxrwxr-x  2 vagrant vagrant   4096 Aug 30 18:55 config
drwxrwxr-x  5 vagrant vagrant   4096 Aug 30 18:55 database
-rw-rw-r--  1 vagrant vagrant   1129 Aug 30 18:55 package.json
-rw-rw-r--  1 vagrant vagrant   1040 Aug 30 18:55 phpunit.xml
drwxrwxr-x  4 vagrant vagrant   4096 Aug 30 18:55 public
-rw-rw-r--  1 vagrant vagrant   3491 Aug 30 18:55 readme.md
drwxrwxr-x  5 vagrant vagrant   4096 Aug 30 18:55 resources
drwxrwxr-x  2 vagrant vagrant   4096 Aug 30 18:55 routes
-rw-rw-r--  1 vagrant vagrant    563 Aug 30 18:55 server.php
drwxrwxr-x  5 vagrant vagrant   4096 Aug 30 18:55 storage
drwxrwxr-x  4 vagrant vagrant   4096 Aug 30 18:55 tests
drwxrwxr-x 36 vagrant vagrant   4096 Oct 22 16:43 vendor
-rw-rw-r--  1 vagrant vagrant    549 Aug 30 18:55 webpack.mix.js

なんかワサワサできてる

ブラウザで http://{vagrantSV IP}/webapp000/public/ にアクセス

"The stream or file "/var/www/html/webapp000/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied"

vagrantでproject作成したのでオーナーがvagrant
apacheは…
apache 1680 0.0 0.6 334188 13856 ? S 16:28 0:00 /usr/sbin/httpd
apacheで動かしてるので

##書き込み権限

command
$ cd storage/
$ ll
total 12
drwxrwxr-x 3 vagrant vagrant 4096 Aug 30 18:55 app
drwxrwxr-x 6 vagrant vagrant 4096 Aug 30 18:55 framework
drwxrwxr-x 2 vagrant vagrant 4096 Aug 30 18:55 logs
$ chmod -R 777 logs/

再度ブラウザで http://{vagrantSV IP}/webapp000/public/ にアクセス

file_put_contents(/var/www/html/webapp000/storage/framework/sessions/odS4tBslQQJXMKkSW9FknIbdUg9zNVVtnRk0HbDe): failed to open stream: Permission denied"

ふーん、、、、

##こっちも

command
$ chmod -R 777 /framework/

http://{vagrantSV IP}/webapp000/public/

これでlaravelのwelcome(sample)画面が表示されるはずです

とりあえずここまで。:frowning2:

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?