質問編集履歴

3

追記テスト内容を最下部に記載

2019/03/17 02:29

投稿

NOBUTUNA
NOBUTUNA

スコア11

test CHANGED
File without changes
test CHANGED
@@ -113,3 +113,31 @@
113
113
  ■MixHost側 phpinfo() の結果
114
114
 
115
115
  ![イメージ説明](4080b401cf891ca42ecbc93d2436947d.png)
116
+
117
+
118
+
119
+
120
+
121
+ ■追記テスト
122
+
123
+ ```php
124
+
125
+ <?php
126
+
127
+ $test = "cd ../../blog && /home/gqrfvmyf/bin/wp-cli.phar post create \"../revival-stock-check/ready/result/2019_03_17/11.txt\" --post_title=\"2019年03月17日11時 の在庫状況\" --post_category=2 --user=admin --tags_input=在庫リスト --post_status=publish --post_name=\"stock_list\"";
128
+
129
+ passthru($test);
130
+
131
+ ```
132
+
133
+ 該当のエラーが発生している箇所と同じディレクトリに上記ファイルを作成し、以下コマンドで実行したところ成功いたしました。
134
+
135
+ php test.php
136
+
137
+
138
+
139
+ ですが、URL にて http://*******/test.php
140
+
141
+ にて遷移し test.php を実行したところ、Content-type: text/html; charset=UTF-8 が出力され、記事は投稿されませんでした。
142
+
143
+ PHPコマンドライン上で実行するのと、ページ遷移時に実行されるのとで挙動が変わっているようです。

2

passthru関数実行時の出力の記載を追記

2019/03/17 02:29

投稿

NOBUTUNA
NOBUTUNA

スコア11

test CHANGED
File without changes
test CHANGED
@@ -76,6 +76,8 @@
76
76
 
77
77
  Content-type: text/html; charset=UTF-8
78
78
 
79
+ (他の環境では成功するため、 "Success: Created post {数字}" が返ってくる)
80
+
79
81
 
80
82
 
81
83
  ■事象が発生している環境

1

local / MixHost 側それぞれの phpinfo() 画像を添付

2019/03/17 02:03

投稿

NOBUTUNA
NOBUTUNA

スコア11

test CHANGED
File without changes
test CHANGED
@@ -99,3 +99,15 @@
99
99
  $wp_cli_commandに格納されている文字列をコマンドライン上で直打ちすると記事は投稿されており、なぜPHPで実行すると正しく処理が行えないのか原因がつかめずにおります。
100
100
 
101
101
  local環境では問題なく記事は投稿されるため、MixHost側で何か設定を変える必要があるのかなどを調べましたが、私の力では解決まで導区ことができませんでした。
102
+
103
+
104
+
105
+ ■local環境 phpinfo() の結果
106
+
107
+ ![イメージ説明](8a136526e4436ff37596736f2ff2c0df.png)
108
+
109
+
110
+
111
+ ■MixHost側 phpinfo() の結果
112
+
113
+ ![イメージ説明](4080b401cf891ca42ecbc93d2436947d.png)