#php Laravel
PHP歴は長いものの、オレオレ手法ばかりでしたが
(MVC&オブジェクト指向をゴリゴリ書く)
訳があってフレームワークを勉強中
※環境構築やlaravel環境構築は先駆者様達を参考に
#環境
windwos vagrant centos6.9 apache php7 mysql5.6.37
###centos
$ more /etc/redhat-release
CentOS release 6.9 (Final)
###apache
$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 15 2017 19:44:58
###php
$ php -v
PHP 7.1.8 (cli) (built: Aug 2 2017 14:25:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group
###mysql
$ 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とす
$ ./composer.phar create-project laravel/laravel /var/www/html/webapp000
##確認
$ 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で動かしてるので
##書き込み権限
$ 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"
ふーん、、、、
##こっちも
$ chmod -R 777 /framework/
http://{vagrantSV IP}/webapp000/public/
これでlaravelのwelcome(sample)画面が表示されるはずです
とりあえずここまで。