teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

新たなコードの追記

2018/06/25 04:52

投稿

n_oshiumi
n_oshiumi

スコア16

title CHANGED
File without changes
body CHANGED
@@ -124,4 +124,72 @@
124
124
  phalcon_mariadb | Version: '10.2.15-MariaDB-10.2.15+maria~jessie' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binar
125
125
  y distribution
126
126
  phalcon_mariadb | 2018-06-20 3:30:38 140096783243008 [Note] InnoDB: Buffer pool(s) load completed at 180620 3:30:38
127
+ ```
128
+
129
+
130
+ ## 追記 Docer-compose.yml
131
+
132
+ ```Docer-compose.yml
133
+ version: '3.4'
134
+
135
+ services:
136
+ mysql:
137
+ restart: always
138
+ image: mariadb:10.2
139
+ container_name: phalcon_mariadb
140
+ ports:
141
+ - 3306:3306
142
+ environment:
143
+ MYSQL_DATABASE: test
144
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
145
+ volumes:
146
+ - mysql:/var/lib/mysql
147
+
148
+ php:
149
+ restart: always
150
+ build: ./
151
+ container_name: phalcon_php
152
+ ports:
153
+ # php-fpm
154
+ - 9000:9000
155
+ environment:
156
+ APP_ENV: 'development'
157
+ XDEBUG_REMOTE_HOST: 'host.docker.internal'
158
+ XDEBUG_REMOTE_PORT: '9005'
159
+ XDEBUG_IDE: 'VSCODE'
160
+ DB_HOST: 'mysql'
161
+ volumes:
162
+ - ./php:/app/php
163
+ - ./html:/app/html
164
+ - ./config/www.conf:/usr/local/etc/php-fpm.d/www.conf
165
+ - ./config/phalcon.ini:/usr/local/etc/php/conf.d/phalcon.ini
166
+ depends_on:
167
+ - mysql
168
+
169
+ nginx:
170
+ restart: always
171
+ image: phalconphp/nginx:1.10
172
+ container_name: phalcon_nginx
173
+ ports:
174
+ - 80:80
175
+ volumes:
176
+ - ./config/nginx.conf:/etc/nginx/conf.d/test.template
177
+ - ./src:/app/src
178
+ - ./html:/app/html
179
+ environment:
180
+ HOST_NAME: 'test.local'
181
+ PHP_CONTAINER: 'php'
182
+ command: >
183
+ sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\"
184
+ < /etc/nginx/conf.d/test.template
185
+ > /etc/nginx/conf.d/default.conf
186
+ && nginx -g 'daemon off;'"
187
+ depends_on:
188
+ - php
189
+
190
+ # docker volume create --name=mysql
191
+ volumes:
192
+ mysql:
193
+ external: true
194
+
127
195
  ```

4

エラーログの追記

2018/06/25 04:52

投稿

n_oshiumi
n_oshiumi

スコア16

title CHANGED
File without changes
body CHANGED
@@ -66,4 +66,62 @@
66
66
  ]
67
67
  ],
68
68
 
69
+ ```
70
+
71
+
72
+ ## ログの追記
73
+
74
+ PHPのエラーログ
75
+
76
+ ```
77
+ phalcon_php | 172.18.0.4 - 20/Jun/2018:03:34:43 +0000 "GET /index.php" 200
78
+ phalcon_php | [20-Jun-2018 03:34:44] WARNING: [pool www] child 8 exited on signal 4 (SIGILL) after 6.481382 seconds from start
79
+ phalcon_php | [20-Jun-2018 03:34:44] NOTICE: [pool www] child 9 started
80
+ ```
81
+
82
+ nginxのエラーログ
83
+
84
+ ```
85
+ phalcon_nginx | 172.18.0.1 - - [20/Jun/2018:03:36:35 +0000] "GET / HTTP/1.1" 200 394 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_
86
+ 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" "-"
87
+ phalcon_nginx | 172.18.0.1 - - [20/Jun/2018:03:36:36 +0000] "GET /favicon.ico HTTP/1.1" 200 1150 "http://test.local/" "Mozilla/5.0 (
88
+ Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" "-"
89
+ phalcon_nginx | 172.18.0.1 - - [20/Jun/2018:03:36:36 +0000] "GET /api/initialize?timezone=Asia/Tokyo HTTP/1.1" 502 568 "http://test.
90
+ local/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" "-"
91
+ phalcon_nginx | 2018/06/20 03:36:36 [error] 13#13: *26 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.18.0.1, server: test.local, request: "GET /api/initialize?timezone=Asia/Tokyo HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "test.local", referrer: "http://test.local/"
92
+ ```
93
+
94
+ mysqlのエラーログ
95
+
96
+ 今実行してもmysqlのエラーは何も出ないのですが、知らないうちにエラーが溜まっていました。
97
+
98
+ ```
99
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Compressed tables use zlib 1.2.8 [0/139]
100
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Using Linux native AIO
101
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Number of pools: 1
102
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Using SSE2 crc32 instructions
103
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk
104
+ size = 128M
105
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Completed initialization of buffer pool
106
+ phalcon_mariadb | 2018-06-20 3:30:36 140097225074432 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread pr
107
+ iority can be changed. See the man page of setpriority().
108
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Highest supported file format is Barracuda.
109
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: 128 out of 128 rollback segments are active.
110
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Creating shared tablespace for temporary tables
111
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file
112
+ full; Please wait ...
113
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
114
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: Waiting for purge to start
115
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] InnoDB: 5.7.22 started; log sequence number 172722127
116
+ phalcon_mariadb | 2018-06-20 3:30:36 140096783243008 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
117
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] Plugin 'FEEDBACK' is disabled.
118
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] Server socket created on IP: '::'.
119
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Warning] 'proxies_priv' entry '@% root@273f5a19507c' ignored in --skip-name-reso
120
+ lve mode.
121
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] Reading of all Master_info entries succeded
122
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] Added new Master_info '' to hash table
123
+ phalcon_mariadb | 2018-06-20 3:30:36 140097962047360 [Note] mysqld: ready for connections.
124
+ phalcon_mariadb | Version: '10.2.15-MariaDB-10.2.15+maria~jessie' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binar
125
+ y distribution
126
+ phalcon_mariadb | 2018-06-20 3:30:38 140096783243008 [Note] InnoDB: Buffer pool(s) load completed at 180620 3:30:38
69
127
  ```

3

誤字

2018/06/20 03:42

投稿

n_oshiumi
n_oshiumi

スコア16

title CHANGED
File without changes
body CHANGED
@@ -6,10 +6,6 @@
6
6
  最近、XAMPPからDockerに切り替えました。
7
7
  Docker for Macで環境構築をして、アプリケーションを動かしたいのですが、なぜか502エラーが出ました。
8
8
 
9
- ```
10
- phalcon_php | [18-Jun-2018 00:06:33] WARNING: [pool www] child 6 exited on signal 4 (SIGILL) after 549.851562 seconds from start
11
- phalcon_nginx | 2018/06/18 00:06:33 [error] 5#5: *3 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.18.0.1, server: test.local, request: "GET /api/initialize?timezone=Asia/Tokyo HTTP/1.1", upstream: "fastcgi://172.18.0.4:9000", host: "test.local", referrer: "http://test.local/"
12
- ```
13
9
 
14
10
  そこで、xdebugを使ってデバッグしたところ、indexControllerに記載されていた、executeクエリが失敗していました。(データベースとの接続の問題?)
15
11
 
@@ -70,6 +66,4 @@
70
66
  ]
71
67
  ],
72
68
 
73
- ```
69
+ ```
74
-
75
- - DBの稼働状況

2

誤字

2018/06/19 01:42

投稿

n_oshiumi
n_oshiumi

スコア16

title CHANGED
File without changes
body CHANGED
@@ -51,7 +51,7 @@
51
51
  'host' => getenv('DB_HOST') ?: 'localhost',
52
52
  'username' => 'root',
53
53
  'password' => '',
54
- 'dbname' => 'reachat',
54
+ 'dbname' => 'test',
55
55
  'persistent' => true
56
56
  ],
57
57
  'production' => [

1

エラーが発生しているソース、DB接続情報を追記しました。

2018/06/18 05:48

投稿

n_oshiumi
n_oshiumi

スコア16

title CHANGED
File without changes
body CHANGED
@@ -18,4 +18,58 @@
18
18
  他の2人はうまくいっているので、コードに問題はないかと思うのですが、データベース接続も含めてphalconやdocker、apcなどのバージョンは全て同じであることは確認しました。
19
19
  executeクエリが失敗している原因で考えられるものは他にありますでしょうか?
20
20
 
21
- ご回答よろしくお願いします。。
21
+ ご回答よろしくお願いします。。
22
+
23
+
24
+ # 追記
25
+
26
+ - 実際にエラーが発生しているソース
27
+
28
+ $WritingTotalPointsは、ブログの一ヶ月間の文字数の合計です。
29
+ $columnsと$startOfMonth, $startOfNextMonthはXdebugを使って変数にちゃんとデータが入っていることを確認しました。
30
+ dockerのコンテナに入り、blogテーブルとそれぞれのデータがあることは確認しました。
31
+ execute(); で失敗しています。
32
+
33
+ ```indexController.php
34
+ $WritingTotalPoints = \Blog::query()
35
+ ->columns($columns)
36
+ ->innerJoin('Site', 'Site.id = Blog.siteId')
37
+ ->where("Blog.contentDueDate >= '{$startOfMonth}' AND Blog.contentDueDate < '{$startOfNextMonth}'")
38
+ ->execute();
39
+ ```
40
+
41
+ - DB接続情報
42
+ セキュリティ的にはよくないかもしれませんが、そこはスルーで、、、。
43
+
44
+ ```app.php
45
+
46
+ 'database' => [
47
+ 'isAutoCast' => true,
48
+ 'mysql' => [
49
+ 'development' => [
50
+ 'adapter' => 'Mysql',
51
+ 'host' => getenv('DB_HOST') ?: 'localhost',
52
+ 'username' => 'root',
53
+ 'password' => '',
54
+ 'dbname' => 'reachat',
55
+ 'persistent' => true
56
+ ],
57
+ 'production' => [
58
+ 'adapter' => 'Mysql',
59
+ 'host' => getenv('DB_HOST'),
60
+ 'username' => getenv('DB_USER'),
61
+ 'password' => getenv('DB_PASS'),
62
+ 'dbname' => getenv('DB_NAME'),
63
+ 'persistent' => true
64
+ ]
65
+ ],
66
+ 'results' => [
67
+ 'flatten' => true,
68
+ 'masterValues' => 'extract', // null | extract
69
+ 'scope' => 'public', // null | public | protected | private
70
+ ]
71
+ ],
72
+
73
+ ```
74
+
75
+ - DBの稼働状況