centos 7+php+mysql+python爬虫類の結果をWebページに表示
717 ワード
php実行コンソール命令
apache権限の追加
selinuxを閉じる
shell_exec python 3のパスの使用
python符号化エラー防止
ヘッドレスブラウザパスの問題の解決
php-mysql検索文字列に引用符を付ける
$output = shell_exec('');
apache権限の追加
~ visudc = vi /etc/sudoers
root ALL=(ALL) ALL
apache ALL=(ALL) NOPASSWD: ALL
selinuxを閉じる
setenforce 0
shell_exec python 3のパスの使用
$output = shell_exec('sudo /.../python');
python符号化エラー防止
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
ヘッドレスブラウザパスの問題の解決
driver = webdriver.PhantomJS(executable_path='...\phantomjs')
php-mysql検索文字列に引用符を付ける
'............... word = \''.$word.'\'';